import { createActionGroup, emptyProps, props } from '@ngrx/store';
import { FiscalYear, CreateFiscalYear, UpdateFiscalYear } from '../../models/fiscal-year.model';
import { PaginationMeta } from '../../models/api.model';

export const FiscalYearsActions = createActionGroup({
  source: 'FiscalYears',
  events: {
    'Load Fiscal Years': props<{ page?: number; perPage?: number; forceReload?: boolean }>(),
    'Load Fiscal Years Success': props<{ fiscalYears: FiscalYear[]; meta: PaginationMeta }>(),
    'Load Fiscal Years Failure': props<{ error: string }>(),
    'Create Fiscal Year': props<{ fiscalYear: CreateFiscalYear }>(),
    'Create Fiscal Year Success': props<{ fiscalYear: FiscalYear }>(),
    'Create Fiscal Year Failure': props<{ error: string }>(),
    'Update Fiscal Year': props<{ id: number; fiscalYear: UpdateFiscalYear }>(),
    'Update Fiscal Year Success': props<{ fiscalYear: FiscalYear }>(),
    'Update Fiscal Year Failure': props<{ error: string }>(),
    'Delete Fiscal Year': props<{ id: number }>(),
    'Delete Fiscal Year Success': props<{ id: number }>(),
    'Delete Fiscal Year Failure': props<{ error: string }>(),
    'Clear Fiscal Years Error': emptyProps(),
  },
});
