import { createActionGroup, emptyProps, props } from '@ngrx/store';
import { PaginationMeta } from '../../../models/api.model';
import {
  HrPosition,
  CreateHrPosition,
  UpdateHrPosition,
} from '../../../models/hr-position.model';

export const HrPositionsActions = createActionGroup({
  source: 'HR Positions',
  events: {
    'Load HR Positions': props<{
      page?: number;
      perPage?: number;
      forceReload?: boolean;
    }>(),
    'Load HR Positions Success': props<{ positions: HrPosition[]; meta: PaginationMeta }>(),
    'Load HR Positions Failure': props<{ error: string }>(),
    'Create HR Position': props<{ position: CreateHrPosition }>(),
    'Create HR Position Success': props<{ position: HrPosition }>(),
    'Create HR Position Failure': props<{ error: string }>(),
    'Update HR Position': props<{ id: number; position: UpdateHrPosition }>(),
    'Update HR Position Success': props<{ position: HrPosition }>(),
    'Update HR Position Failure': props<{ error: string }>(),
    'Delete HR Position': props<{ id: number }>(),
    'Delete HR Position Success': props<{ id: number }>(),
    'Delete HR Position Failure': props<{ error: string }>(),
    'Clear HR Positions Error': emptyProps(),
  },
});
