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

export const SalesQuotationsActions = createActionGroup({
  source: 'Sales Quotations',
  events: {
    'Load Quotations': props<{ page?: number; perPage?: number; force?: boolean }>(),
    'Load Quotations Success': props<{ quotations: SalesQuotation[]; meta: PaginationMeta }>(),
    'Load Quotations Failure': props<{ error: string }>(),
    'Create Quotation': props<{ data: any }>(),
    'Create Quotation Success': props<{ quotation: SalesQuotation }>(),
    'Create Quotation Failure': props<{ error: string }>(),
    'Update Quotation': props<{ id: number; data: any }>(),
    'Update Quotation Success': props<{ quotation: SalesQuotation }>(),
    'Update Quotation Failure': props<{ error: string }>(),
    'Delete Quotation': props<{ id: number }>(),
    'Delete Quotation Success': props<{ id: number }>(),
    'Delete Quotation Failure': props<{ error: string }>(),
    'Send Quotation': props<{ id: number }>(),
    'Send Quotation Success': props<{ quotation: SalesQuotation }>(),
    'Send Quotation Failure': props<{ error: string }>(),
    'Accept Quotation': props<{ id: number }>(),
    'Accept Quotation Success': props<{ quotation: SalesQuotation }>(),
    'Accept Quotation Failure': props<{ error: string }>(),
    'Reject Quotation': props<{ id: number }>(),
    'Reject Quotation Success': props<{ quotation: SalesQuotation }>(),
    'Reject Quotation Failure': props<{ error: string }>(),
    'Convert Quotation To Order': props<{ id: number }>(),
    'Convert Quotation To Order Success': props<{ quotation: SalesQuotation }>(),
    'Convert Quotation To Order Failure': props<{ error: string }>(),
    'Convert Quotation To Invoice': props<{ id: number }>(),
    'Convert Quotation To Invoice Success': props<{ quotation: SalesQuotation }>(),
    'Convert Quotation To Invoice Failure': props<{ error: string }>(),
    'Cancel Quotation': props<{ id: number }>(),
    'Cancel Quotation Success': props<{ quotation: SalesQuotation }>(),
    'Cancel Quotation Failure': props<{ error: string }>(),
    'Duplicate Quotation': props<{ id: number }>(),
    'Duplicate Quotation Success': props<{ quotation: SalesQuotation }>(),
    'Duplicate Quotation Failure': props<{ error: string }>(),
    'Clear Quotations Error': emptyProps(),
  },
});
