import { createActionGroup, emptyProps, props } from '@ngrx/store';
import { CheckReceived, CreateCheckReceived, UpdateCheckReceived } from '../../models/check-received.model';
import { PaginationMeta } from '../../models/api.model';

export const ChecksReceivedActions = createActionGroup({
  source: 'Checks Received',
  events: {
    'Load Checks Received': props<{ page?: number; perPage?: number; forceReload?: boolean }>(),
    'Load Checks Received Success': props<{ checks: CheckReceived[]; meta: PaginationMeta }>(),
    'Load Checks Received Failure': props<{ error: string }>(),
    'Create Check Received': props<{ check: CreateCheckReceived }>(),
    'Create Check Received Success': props<{ check: CheckReceived }>(),
    'Create Check Received Failure': props<{ error: string }>(),
    'Update Check Received': props<{ id: number; check: UpdateCheckReceived }>(),
    'Update Check Received Success': props<{ check: CheckReceived }>(),
    'Update Check Received Failure': props<{ error: string }>(),
    'Delete Check Received': props<{ id: number }>(),
    'Delete Check Received Success': props<{ id: number }>(),
    'Delete Check Received Failure': props<{ error: string }>(),
    'Deposit Check Received': props<{ id: number; bankAccountId: number }>(),
    'Deposit Check Received Success': props<{ check: CheckReceived }>(),
    'Deposit Check Received Failure': props<{ error: string }>(),
    'Collect Check Received': props<{ id: number }>(),
    'Collect Check Received Success': props<{ check: CheckReceived }>(),
    'Collect Check Received Failure': props<{ error: string }>(),
    'Clear Checks Received Error': emptyProps(),
  },
});
