import { createAction, props } from '@ngrx/store';

import { Login2Response } from '@ucap-webmessenger/pi';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';

import { LoginInfo } from '../../../types';

export const webLogin = createAction(
  '[Account::Authentication] Web Login',
  props<{
    loginInfo: LoginInfo;
    rememberMe: boolean;
  }>()
);

export const webLoginSuccess = createAction(
  '[Account::Authentication] Web Login Success',
  props<{
    loginInfo: LoginInfo;
    rememberMe: boolean;
    login2Response: Login2Response;
  }>()
);

export const webLoginFailure = createAction(
  '[Account::Authentication] Web Login Failure',
  props<{ error: any }>()
);

export const loginSuccess = createAction(
  '[Account::Authentication] Login Success',
  props<{
    loginInfo: LoginResponse;
  }>()
);

export const loginFailure = createAction(
  '[Account::Authentication] Login Failure',
  props<{ error: any }>()
);

export const loginRedirect = createAction(
  '[Account::Authentication] Login Redirect'
);

export const logout = createAction('[Account::Authentication] Logout');

export const logoutConfirmation = createAction(
  '[Account::Authentication] Logout Confirmation'
);

export const logoutConfirmationDismiss = createAction(
  '[Account::Authentication] Logout Confirmation Dismiss'
);
