import { createActionGroup, emptyProps, props } from '@ngrx/store';
import { PaginationMeta } from '../../../models/api.model';
import {
  HrLeaveType,
  CreateHrLeaveType,
  UpdateHrLeaveType,
} from '../../../models/hr-leave.model';

export const HrLeaveTypesActions = createActionGroup({
  source: 'HR Leave Types',
  events: {
    'Load HR Leave Types': props<{
      page?: number;
      perPage?: number;
      forceReload?: boolean;
    }>(),
    'Load HR Leave Types Success': props<{
      leaveTypes: HrLeaveType[];
      meta: PaginationMeta;
    }>(),
    'Load HR Leave Types Failure': props<{ error: string }>(),
    'Create HR Leave Type': props<{ leaveType: CreateHrLeaveType }>(),
    'Create HR Leave Type Success': props<{ leaveType: HrLeaveType }>(),
    'Create HR Leave Type Failure': props<{ error: string }>(),
    'Update HR Leave Type': props<{ id: number; leaveType: UpdateHrLeaveType }>(),
    'Update HR Leave Type Success': props<{ leaveType: HrLeaveType }>(),
    'Update HR Leave Type Failure': props<{ error: string }>(),
    'Delete HR Leave Type': props<{ id: number }>(),
    'Delete HR Leave Type Success': props<{ id: number }>(),
    'Delete HR Leave Type Failure': props<{ error: string }>(),
    'Clear HR Leave Types Error': emptyProps(),
  },
});
