import { GoodsIn } from '../../models/goods-in.model';
import { OrderItemListItemDTO } from '@swagger/oms';
import { GoodsInSearch } from '../../models/GoodsInSearch.model';

export const SET = '[GOODS-IN] Set';
export const RELOAD = '[GOODS-IN] Reload';
export const SET_GOODS_IN_ORDERS = '[GOODS-IN] Set orders';
export const SET_GOODS_IN_CACHED_ORDERS = '[GOODS-IN] Set cached orders';
export const CLEAR_GOODS_IN_CACHED_ORDERS = '[GOODS-IN] Clear cached orders';
export const SET_GOODS_IN_SEARCH = '[GOODS-IN] Set goods in search';
export const SET_USE_CASHE = '[GOODS-IN] Update useCache propertie';

export class SetGoodsIn {
  static readonly type = SET;

  constructor(public goodsIn?: GoodsIn) {}
}

export class ReloadGoodsIn {
  static readonly type = RELOAD;

  constructor(public goodsIn: GoodsIn) {}
}

export class SetGoodsInOrders {
  static readonly type = SET_GOODS_IN_ORDERS;

  constructor(public orders: OrderItemListItemDTO[]) {}
}

export class SetGoodsInCachedOrders {
  static readonly type = SET_GOODS_IN_CACHED_ORDERS;

  constructor(public orders: { results: OrderItemListItemDTO[]; hits: number }) {}
}

export class ClearGoodsInCachedOrders {
  static readonly type = CLEAR_GOODS_IN_CACHED_ORDERS;

  constructor() {}
}

export class SetGoodsInSearch {
  static readonly type = SET_GOODS_IN_SEARCH;

  constructor(public search: GoodsInSearch) {}
}

export class SetGoodsInUseCache {
  static readonly type = SET_USE_CASHE;

  constructor(public useCache: boolean) {}
}
