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

export const SalesReturnsActions = createActionGroup({
  source: 'Sales Returns',
  events: {
    'Load Returns': props<{ page?: number; perPage?: number; force?: boolean }>(),
    'Load Returns Success': props<{ returns: SalesReturn[]; meta: PaginationMeta }>(),
    'Load Returns Failure': props<{ error: string }>(),
    'Create Return': props<{ data: any }>(),
    'Create Return Success': props<{ salesReturn: SalesReturn }>(),
    'Create Return Failure': props<{ error: string }>(),
    'Update Return': props<{ id: number; data: any }>(),
    'Update Return Success': props<{ salesReturn: SalesReturn }>(),
    'Update Return Failure': props<{ error: string }>(),
    'Delete Return': props<{ id: number }>(),
    'Delete Return Success': props<{ id: number }>(),
    'Delete Return Failure': props<{ error: string }>(),
    'Submit Return Approval': props<{ id: number }>(),
    'Submit Return Approval Success': props<{ salesReturn: SalesReturn }>(),
    'Submit Return Approval Failure': props<{ error: string }>(),
    'Approve Return': props<{ id: number }>(),
    'Approve Return Success': props<{ salesReturn: SalesReturn }>(),
    'Approve Return Failure': props<{ error: string }>(),
    'Reject Return': props<{ id: number }>(),
    'Reject Return Success': props<{ salesReturn: SalesReturn }>(),
    'Reject Return Failure': props<{ error: string }>(),
    'Post Return': props<{ id: number }>(),
    'Post Return Success': props<{ salesReturn: SalesReturn }>(),
    'Post Return Failure': props<{ error: string }>(),
    'Cancel Return': props<{ id: number }>(),
    'Cancel Return Success': props<{ salesReturn: SalesReturn }>(),
    'Cancel Return Failure': props<{ error: string }>(),
    'Clear Returns Error': emptyProps(),
  },
});
