// 设备维度库存统计类型（对应 /inventory/device-stats 返回的 snake_case 字段）
export interface DeviceInventoryStats {
  device_id_primary: number;
  device_id: string;
  device_name: string;
  shop_id: number;
  shop_name: string;
  shop_address: string;
  remaining_stock: number;
  standard_stock: number;
  product_count: number;
  zero_stock_count: number;
  low_stock_count: number;
  stock_status: string;
  stock_ratio: number;
  has_unknown_product: boolean;
  last_restock_time: string;
}

// 设备库存记录（含商品详情，对应 /inventory/device/{deviceId} 返回的 snake_case 字段）
export interface DeviceInventoryRecord {
  id: number;
  device_id: string;
  product_id: number;
  product_name: string;
  product_code: string;
  stock: number;
  warning_threshold: number;
  shelf_num: number;
  position: string;
  last_restock_time: string;
  update_time: string;
  barcode: string;
  product_image: string;
  cost_price: number;
  retail_price: number;
}

// 按层分组的库存
export interface ShelfGroup {
  shelfNum: number;
  label: string;
  products: DeviceInventoryRecord[];
}

// 库存信息类型（保留，供上货等弹窗使用）
export interface InventoryItem {
  id: number;
  deviceId: string;
  deviceName: string;
  productId: number;
  productName: string;
  productCode: string;
  stock: number;
  shelfNum: number;
  position: string;
  lastUpdateTime: string;
}

// 搜索表单类型
export interface InventorySearchForm {
  deviceId: string;
  shopName: string;
  deviceName: string;
}

// 上货表单类型
export interface StockInForm {
  deviceId: string;
  productId: number;
  productCode: string;
  productName: string;
  quantity: number;
  shelfNum?: number;
  position?: string;
  activityId?: string;
}

// 调整表单类型
export interface StockAdjustForm {
  deviceId: string;
  productId: number;
  newStock: number;
  remark?: string;
}
