import * as ActionTypes from '../actionTypes'
import {
  AuthState,
  Keys,
  LoginMethods,
  SetAuthState,
  UpdateKeyPair,
  UpdateLoginMethod,
  UpdateNsecBunkerPubkey,
  UpdateNsecBunkerRelays
} from './types'

export const setAuthState = (payload: AuthState): SetAuthState => ({
  type: ActionTypes.SET_AUTH_STATE,
  payload
})

export const updateLoginMethod = (
  payload: LoginMethods | undefined
): UpdateLoginMethod => ({
  type: ActionTypes.UPDATE_LOGIN_METHOD,
  payload
})

export const updateKeyPair = (payload: Keys | undefined): UpdateKeyPair => ({
  type: ActionTypes.UPDATE_KEYPAIR,
  payload
})

export const updateNsecbunkerPubkey = (
  payload: string | undefined
): UpdateNsecBunkerPubkey => ({
  type: ActionTypes.UPDATE_NSECBUNKER_PUBKEY,
  payload
})

export const updateNsecbunkerRelays = (
  payload: string[] | undefined
): UpdateNsecBunkerRelays => ({
  type: ActionTypes.UPDATE_NSECBUNKER_RELAYS,
  payload
})
