import type { InferRequestType, InferResponseType } from 'hono/client';
import type { adminGoodsRoutes } from '@d8d/goods-module';

export type CreateRequest = InferRequestType<typeof adminGoodsRoutes.$post>['json'];
export type UpdateRequest = InferRequestType<typeof adminGoodsRoutes[':id']['$put']>['json'];
export type GoodsResponse = InferResponseType<typeof adminGoodsRoutes.$get, 200>['data'][0];

export interface Goods {
  id: number;
  name: string;
  price: number;
  costPrice: number;
  categoryId1: number;
  categoryId2: number;
  categoryId3: number;
  goodsType: number;
  supplierId: number | null;
  merchantId: number | null;
  imageFileId: number | null;
  slideImageIds: number[];
  detail: string;
  instructions: string;
  sort: number;
  state: number;
  stock: number;
  lowestBuy: number;
  salesNum: number;
  createdAt: string;
  updatedAt: string;
  createdBy: number;
  updatedBy: number;
  category1?: {
    id: number;
    name: string;
  };
  category2?: {
    id: number;
    name: string;
  };
  category3?: {
    id: number;
    name: string;
  };
  supplier?: {
    id: number;
    name: string;
  };
  merchant?: {
    id: number;
    name: string;
    username: string;
  };
  imageFile?: {
    id: number;
    fullUrl: string;
  };
  slideImages?: Array<{
    id: number;
    fullUrl: string;
  }>;
}

export interface GoodsListResponse {
  data: Goods[];
  pagination: {
    total: number;
    page: number;
    pageSize: number;
  };
}