import { createActionGroup, emptyProps, props } from '@ngrx/store';
import { Sequence, CreateSequence, UpdateSequence } from '../../models/sequence.model';
import { PaginationMeta } from '../../models/api.model';

export const SequencesActions = createActionGroup({
  source: 'Sequences',
  events: {
    'Load Sequences': props<{ page?: number; perPage?: number; forceReload?: boolean }>(),
    'Load Sequences Success': props<{ sequences: Sequence[]; meta: PaginationMeta }>(),
    'Load Sequences Failure': props<{ error: string }>(),
    'Create Sequence': props<{ sequence: CreateSequence }>(),
    'Create Sequence Success': props<{ sequence: Sequence }>(),
    'Create Sequence Failure': props<{ error: string }>(),
    'Update Sequence': props<{ id: number; sequence: UpdateSequence }>(),
    'Update Sequence Success': props<{ sequence: Sequence }>(),
    'Update Sequence Failure': props<{ error: string }>(),
    'Delete Sequence': props<{ id: number }>(),
    'Delete Sequence Success': props<{ id: number }>(),
    'Delete Sequence Failure': props<{ error: string }>(),
    'Clear Sequences Error': emptyProps(),
  },
});
