import { createAction, props } from '@ngrx/store';
import {
  StrictHttpResponse,
  ListResponseArgsOfOrderItemListItemDTO,
  OrderItemListItemDTO,
  ResponseArgsOfOrderItemSubsetDTO,
} from '@swagger/oms';

const prefix = '[CUSTOMER] [SHELF] [DETAILS]';

export const fetchDetailsByOrderNumber = createAction(`${prefix} Fetch Details By Order Number`, props<{ orderNumber: string }>());

export const fetchDetailsByOrderNumberDone = createAction(
  `${prefix} Fetch Details By Order Number Done`,
  props<{
    response: StrictHttpResponse<ListResponseArgsOfOrderItemListItemDTO>;
  }>()
);

export const fetchDetailsByCompartmentCode = createAction(
  `${prefix} Fetch Details By Compartment Code`,
  props<{ compartmentCode: string }>()
);

export const fetchDetailsByCompartmentCodeDone = createAction(
  `${prefix} Fetch Details By Compartment Code Done`,
  props<{
    response: StrictHttpResponse<ListResponseArgsOfOrderItemListItemDTO>;
  }>()
);

export const fetchDetailsOrderItemIds = createAction(`${prefix} Fetch Details By Order Item Ids`, props<{ orderItemIds: number[] }>());

export const fetchDetailsOrderItemIdsDone = createAction(
  `${prefix} Fetch Details By Order Item Ids Done`,
  props<{
    response: StrictHttpResponse<ListResponseArgsOfOrderItemListItemDTO>;
  }>()
);

export const fetchDetailsOrderItemSubsetIds = createAction(
  `${prefix} Fetch Details By Order Item Subset Ids`,
  props<{ orderItemSubsetIds: number[] }>()
);

export const fetchDetailsOrderItemSubsetIdsDone = createAction(
  `${prefix} Fetch Details By Order Item Subset Ids Done`,
  props<{
    response: StrictHttpResponse<ListResponseArgsOfOrderItemListItemDTO>;
  }>()
);

export const addOrderItems = createAction(`${prefix} Add Order Items`, props<{ orderItems: OrderItemListItemDTO[] }>());

export const patchComment = createAction(
  `${prefix} Patch Comment`,
  props<{ orderItemSubsetId: number; orderItemId: number; orderId: number; comment: string }>()
);

export const patchCommentDone = createAction(
  `${prefix} Patch Comment Done`,
  props<{ response: StrictHttpResponse<ResponseArgsOfOrderItemSubsetDTO> }>()
);

export const cleanup = createAction(`${prefix} Cleanup`);

export const setComment = createAction(`${prefix} Set Comment`, props<{ orderItemSubsetId: number; comment: string }>());
