import { createActionGroup, emptyProps, props } from '@ngrx/store';
import { SalesDeliveryNote } from '../../../models/sales-delivery-note.model';
import { PaginationMeta } from '../../../models/api.model';

export const SalesDeliveryNotesActions = createActionGroup({
  source: 'Sales Delivery Notes',
  events: {
    'Load Delivery Notes': props<{ page?: number; perPage?: number; force?: boolean }>(),
    'Load Delivery Notes Success': props<{
      deliveryNotes: SalesDeliveryNote[];
      meta: PaginationMeta;
    }>(),
    'Load Delivery Notes Failure': props<{ error: string }>(),
    'Create Delivery Note': props<{ data: any }>(),
    'Create Delivery Note Success': props<{ deliveryNote: SalesDeliveryNote }>(),
    'Create Delivery Note Failure': props<{ error: string }>(),
    'Update Delivery Note': props<{ id: number; data: any }>(),
    'Update Delivery Note Success': props<{ deliveryNote: SalesDeliveryNote }>(),
    'Update Delivery Note Failure': props<{ error: string }>(),
    'Delete Delivery Note': props<{ id: number }>(),
    'Delete Delivery Note Success': props<{ id: number }>(),
    'Delete Delivery Note Failure': props<{ error: string }>(),
    'Confirm Delivery Note': props<{ id: number }>(),
    'Confirm Delivery Note Success': props<{ deliveryNote: SalesDeliveryNote }>(),
    'Confirm Delivery Note Failure': props<{ error: string }>(),
    'Ship Delivery Note': props<{ id: number; data: any }>(),
    'Ship Delivery Note Success': props<{ deliveryNote: SalesDeliveryNote }>(),
    'Ship Delivery Note Failure': props<{ error: string }>(),
    'Deliver Delivery Note': props<{ id: number; data: any }>(),
    'Deliver Delivery Note Success': props<{ deliveryNote: SalesDeliveryNote }>(),
    'Deliver Delivery Note Failure': props<{ error: string }>(),
    'Cancel Delivery Note': props<{ id: number }>(),
    'Cancel Delivery Note Success': props<{ deliveryNote: SalesDeliveryNote }>(),
    'Cancel Delivery Note Failure': props<{ error: string }>(),
    'Clear Delivery Notes Error': emptyProps(),
  },
});
