import { InferResponseType, InferRequestType } from 'hono';
import { adminDeliveryAddressRoutes } from '@d8d/delivery-address-module';

// 地址状态枚举
export enum DeliveryAddressState {
  ACTIVE = 1,
  DISABLED = 2,
  DELETED = 3
}

// 默认地址状态枚举
export enum DefaultAddressState {
  NOT_DEFAULT = 0,
  IS_DEFAULT = 1
}

// 地址实体类型
export interface DeliveryAddress {
  id: number;
  userId: number;
  name: string;
  phone: string;
  address: string;
  receiverProvince: number;
  receiverCity: number;
  receiverDistrict: number;
  receiverTown: number;
  state: DeliveryAddressState;
  isDefault: DefaultAddressState;
  createdBy: number | null;
  updatedBy: number | null;
  createdAt: Date;
  updatedAt: Date;
  user?: {
    id: number;
    name: string;
    phone: string;
  };
  province?: {
    id: number;
    name: string;
  };
  city?: {
    id: number;
    name: string;
  };
  district?: {
    id: number;
    name: string;
  };
  town?: {
    id: number;
    name: string;
  };
}

// 创建地址请求类型
export type CreateDeliveryAddressRequest = InferRequestType<typeof adminDeliveryAddressRoutes>['post'];

// 更新地址请求类型
export type UpdateDeliveryAddressRequest = InferRequestType<typeof adminDeliveryAddressRoutes>['/:id']['put'];

// 地址列表响应类型
export type DeliveryAddressListResponse = InferResponseType<typeof adminDeliveryAddressRoutes>['get'];

// 地址详情响应类型
export type DeliveryAddressDetailResponse = InferResponseType<typeof adminDeliveryAddressRoutes>['/:id']['get'];

// 创建地址响应类型
export type CreateDeliveryAddressResponse = InferResponseType<typeof adminDeliveryAddressRoutes>['post'];

// 更新地址响应类型
export type UpdateDeliveryAddressResponse = InferResponseType<typeof adminDeliveryAddressRoutes>['/:id']['put'];

// 删除地址响应类型
export type DeleteDeliveryAddressResponse = InferResponseType<typeof adminDeliveryAddressRoutes>['/:id']['delete'];

// 地址查询参数
export interface DeliveryAddressQueryParams {
  page?: number;
  limit?: number;
  search?: string;
  userId?: number;
  state?: DeliveryAddressState;
}