import * as ActionTypes from '../actionTypes'
import {
  AuthState,
  Keys,
  LoginMethod,
  SetAuthState,
  UpdateKeyPair,
  UpdateLoginMethod,
  NostrLoginAuthMethod,
  UpdateNostrLoginAuthMethod
} from './types'

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

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

export const updateNostrLoginAuthMethod = (
  payload: NostrLoginAuthMethod | undefined
): UpdateNostrLoginAuthMethod => ({
  type: ActionTypes.UPDATE_NOSTR_LOGIN_AUTH_METHOD,
  payload
})

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