import { OrderStatus, WorkStatus } from '@d8d/allin-enums';
import type {
  CreateOrderRequest,
  CreateOrderResponse,
  UpdateOrderRequest,
  UpdateOrderResponse,
  DeleteOrderRequest,
  DeleteOrderResponse,
  GetAllOrdersRequest,
  GetAllOrdersResponse,
  GetOrderByIdRequest,
  GetOrderByIdResponse,
  ActivateOrderRequest,
  ActivateOrderResponse,
  CloseOrderRequest,
  CloseOrderResponse,
  BatchAddPersonsRequest,
  BatchAddPersonsResponse,
  CreateOrderPersonAssetRequest,
  CreateOrderPersonAssetResponse,
  QueryOrderPersonAssetRequest,
  QueryOrderPersonAssetResponse,
  DeleteOrderPersonAssetRequest,
  DeleteOrderPersonAssetResponse
} from './orderClient';

// 订单列表项类型
export type OrderListItem = GetAllOrdersResponse['data'][0];

// 订单详情类型
export type OrderDetail = GetOrderByIdResponse;

// 订单人员资产列表项类型
export type OrderPersonAssetListItem = QueryOrderPersonAssetResponse['data'][0];

// 表单相关类型
export interface OrderFormData {
  orderName: string;
  platformId: number;
  companyId: number;
  channelId: number;
  expectedStartDate: string;
  expectedEndDate?: string;
  orderStatus: OrderStatus;
  workStatus: WorkStatus;
  provinceId?: number;
  cityId?: number;
  districtId?: number;
  address?: string;
  contactPerson?: string;
  contactPhone?: string;
  remark?: string;
}

// 人员选择类型
export interface PersonSelection {
  id: number;
  name: string;
  idCard?: string;
  phone?: string;
}

// 资产关联表单类型
export interface AssetAssociationFormData {
  orderId: number;
  personId: number;
  assetType: string;
  assetFileType: string;
  fileId: number;
  relatedTime: string;
}

// 搜索参数类型
export interface OrderSearchParams {
  orderName?: string;
  platformId?: number;
  companyId?: number;
  channelId?: number;
  orderStatus?: number;
  workStatus?: number;
  startDate?: string;
  endDate?: string;
  page?: number;
  pageSize?: number;
}

// 资产搜索参数类型
export interface AssetSearchParams {
  orderId?: number;
  personId?: number;
  assetType?: string;
  assetFileType?: string;
  page?: number;
  pageSize?: number;
}

// 批量添加人员参数类型
export interface BatchAddPersonsData {
  persons: Array<{
    personId: number;
    role?: string;
    remark?: string;
  }>;
}

export {
  CreateOrderRequest,
  CreateOrderResponse,
  UpdateOrderRequest,
  UpdateOrderResponse,
  DeleteOrderRequest,
  DeleteOrderResponse,
  GetAllOrdersRequest,
  GetAllOrdersResponse,
  GetOrderByIdRequest,
  GetOrderByIdResponse,
  ActivateOrderRequest,
  ActivateOrderResponse,
  CloseOrderRequest,
  CloseOrderResponse,
  BatchAddPersonsRequest,
  BatchAddPersonsResponse,
  CreateOrderPersonAssetRequest,
  CreateOrderPersonAssetResponse,
  QueryOrderPersonAssetRequest,
  QueryOrderPersonAssetResponse,
  DeleteOrderPersonAssetRequest,
  DeleteOrderPersonAssetResponse
};