import type { PaginationData } from '@/types/api'
export interface StatusTreeNode {
  status: string
  statusName: string
  quantity: number
  unit?: string // 数量单位
  children: StatusTreeNode[] | null
}
export interface StatusListNode {
  status: string
  statusName: string
}
export interface SearchForm {
  status?: string
  pauseReason?: number
  platform?: string
  craftCode?: string | string[]
  thirdSkuCode?: string
  supplierProductNo?: string
  batchArrangeNumber?: string
  orderNumber?: string
  customerOrderNumber?: string
  shopOrderNumber?: string
  productMark?: string | number | (string | number)[]
  multi?: boolean | null
  timeType?: number | null
  startTime?: string | null
  endTime?: string | null
  logisticsWayCode?: string
  receiverCountry?: string | string[]
  factoryOrderNumber?: string
  userMark?: string
  sku?: string
  trackingNumber?: string
  replaceShipment?: number | string
  shipmentType?: number | string
  tagsIdArr?: string[]
  /** list_page 查询：客户标签 id，逗号分隔（由 tagsIdArr 转换） */
  tagsId?: string
  source?: string
  size?: string
  logisticsWayId?: number | string
  logisticsCompanyCode?: string
  interceptStatus?: boolean
  standardDesignImage?: number
  productMarkList?: string[]
  podCustomizedQuantity?: string
  cpCustomizedQuantity?: string
  /** list_page 排序字段，需与 order 同时传递 */
  prop?: string
  /** list_page 排序方向：asc 正序，desc 倒序 */
  order?: 'asc' | 'desc'
  customerNo?: string // 客户交运单号
}

export interface FactoryOrderNewListData {
  id: number
  factoryOrderNumber?: string
  factoryNo?: number
  factoryCode?: string
  factoryCountryCode?: string
  warehouseId?: number
  warehouseName?: string
  namespace?: string
  status?: string
  platform?: string
  shopNumber?: string
  weight?: number
  productAmount?: number
  totalAmount?: number
  productNum?: number
  shipmentType?: number
  expressSheet?: string
  trackingNumber?: string
  processNumber?: string
  userMark?: string
  receiverName?: string
  receiverPhone?: string
  receiverCountry?: string
  receiverProvince?: string
  receiverCity?: string
  receiverDistrict?: string
  receiverAddress1?: string
  receiverAddress2?: string
  receiverPostCode?: string
  trackStatus?: number
  prepaidAmount?: number
  pause?: boolean
  serviceAmount?: number
  mixed?: boolean
  tagsId?: string
  source?: string
  logisticsCompanyName?: string
  logisticsCompanyCode?: string
  selfOwned?: boolean
  createTime?: string
  updateTime?: string
  version?: number
  totalCustomsWeight?: number
  totalCustomsValue?: number
  statusName?: string
  thirdOrderNumber?: string
}

export interface ProductListData {
  id: number
  podOrderId: number
  factoryCode?: string
  productName?: string
  baseSku?: string
  variantSku?: string
  variantImage?: string
  variant_image?: string
  productMark?: string
  diyId?: string
  templateType?: number
  customTemplateItemId?: number
  endProductId?: string
  craftSource?: number
  craftCode?: string
  craftName?: string
  craftType?: string
  customizedQuantity: number
  categoryId?: number
  categoryName?: string
  productPrice?: number
  templatePrice?: number
  craftPrice?: number
  imageAry?: string
  designImages?: string
  trimDesignImages?: string
  sizeType?: number
  num?: number
  passNum?: number
  notPassNum?: number
  payAmount?: number
  weight?: number
  createTime?: string
  updateTime?: string
  version?: number
  remark?: string
}
export interface operateOrderListData {
  id: number
  operationNo?: string
  podOrderId?: number
  podOrderNo?: string
  podOrderProductId?: number
  baseSku?: string
  variantSku?: string
  variantImage?: string
  thirdSpuCode?: string
  thirdSkuCode?: string
  originThirdSkuCode?: string
  supplierProductNo?: string
  productName?: string
  productMark?: string
  customizedQuantity?: number
  quantity?: number
  isReplenishment?: boolean
  totalProductionNum?: number
  status?: string
  outOfStock?: boolean
  arrange?: boolean
  version?: number
  createTime?: string
  updateTime?: string
  factoryNo?: number
  factoryCode?: string
  factoryCountryCode?: string
  warehouseId?: number
  namespace?: string
  statusName?: string
  tagsId?: string
  [key: string]: unknown
}

export interface LogListData {
  id: number
  bizId?: number | string
  employeeName?: string
  description?: string
  createTime?: string
}

export interface BatchManageData {
  id: number
  factoryId?: number
  batchArrangeNum?: string
  billType?: string
  url?: string
  tiffUrl?: string
  syntheticStatus?: boolean
  downloadStatus?: boolean
  productNum?: number
  materialNum?: number
  craftType?: string
  employeeAccount?: string
  employeeId?: number
  createTime?: string
  failReason?: string
  failTime?: string
  automaticComposing?: boolean
  composingParam?: string
  printProductOrder?: boolean
  printPickOrder?: boolean
  prnUrl?: string
  prnDownloadStatus?: string
  enableArrange?: boolean
  standardDesignImage?: number
  type?: string
}

export interface BatchReturnVOItem {
  id: number
  status: boolean
  number?: string
  message?: string
}
export interface PrintProductionPdfResult {
  id: number
  status: boolean
  number?: string
  message?: string
  batchReturnVOList: BatchReturnVOItem[] | null
}

export interface RestockData {
  id: number
  factoryId: number
  warehouseId: number
  warehouseName?: string
  locationId?: number
  locationCode?: string
  warehouseSku?: string
  customSku?: string
  skuName?: string
  unit: string | null
  occupyInventory?: number
  freezeInventory?: number
  inventory?: number
  upperLimit?: number
  floorLimit?: number
  productNo?: string
  customerName?: string
  userMark?: string
  createTime?: string
  updateTime?: string
  productItem?: string
  usableInventory?: number
  image?: string
  price?: number
  costPrice?: number | null
  skuImage?: string | null
  currencyCode?: string
  currencyName?: string
  sumOccupyInventory?: number
  thirdSkuCode?: string
}

export interface PickCompleteData {
  id: number
  warehouseId: number
  warehouseName?: string
  skuImage?: string
  productName?: string
  supplierProductNo?: string
  thirdSkuCode?: string
  selectedQuantity?: number
  availableInventory?: number
  inventory?: number
  producingQuantity?: number
  occupyInventory?: number
  pickingStatus?: string
  availableOrderIds?: number[]
  allOrderIds: number[]
  freezeInventory?: number
}

export interface PickFailData {
  id: number
  warehouseName?: string
  skuImage?: string
  productName?: string
  styleNo?: string
  stockSku?: string
  currentStock?: number
  occupiedQuantity?: number
  currentAvailableStock?: number
  producingQuantity?: number
  suggestOutQuantity?: number
  afterOutStock?: number
  afterOutOccupied?: number
  afterOutAvailable?: number
}

export type CardLayoutListFetcher = (
  payload: Record<string, unknown>,
  currentPage: number,
  pageSize: number,
) => Promise<PaginationData<operateOrderListData>>

export interface OrderInventoryData {
  id?: number
  image?: string
  warehouseName?: string
  locationCode?: string
  warehouseSku?: string
  productNo?: string
  skuName?: string
  shortageQuantity?: number
  salesNum?: number
  demandQuantity?: number
  usableQuantity?: number
  inventory?: number
  occupyInventory?: number
  freezeInventory?: number
  variantImage?: string
  inventoryStatus?: number
}
