import type { InferResponseType, InferRequestType } from 'hono/client';
import { disabilityClient } from './disabilityClient';

// 残疾人列表查询参数类型
export type DisabilitySearchParams = {
  page: number;
  pageSize: number;
  keyword?: string;
};

// 分页响应类型
export type PaginatedResponse<T> = {
  data: T[];
  total: number;
};

// 使用Hono类型推导
export type CreateDisabledPersonRequest = InferRequestType<typeof disabilityClient.createDisabledPerson.$post>['json'];
export type UpdateDisabledPersonRequest = InferRequestType<typeof disabilityClient.updateDisabledPerson.$post>['json'];
export type DeleteDisabledPersonRequest = InferRequestType<typeof disabilityClient.deleteDisabledPerson.$post>['json'];

export type DisabledPersonResponse = InferResponseType<typeof disabilityClient.getDisabledPerson[':id']['$get'], 200>;
export type DisabledPersonListResponse = InferResponseType<typeof disabilityClient.getAllDisabledPersons.$get, 200>;
export type DisabledPersonData = InferResponseType<typeof disabilityClient.getAllDisabledPersons.$get, 200>['data'][0];

// 搜索相关类型
export type SearchDisabledPersonRequest = InferRequestType<typeof disabilityClient.searchDisabledPersons.$get>['query'];
export type SearchDisabledPersonResponse = InferResponseType<typeof disabilityClient.searchDisabledPersons.$get, 200>;

// 区域选择器相关类型
export type AreaSelection = {
  provinceId?: number;
  cityId?: number;
  districtId?: number;
};

// 前端表单类型（包含区域ID）
export type DisabilityFormData = Omit<CreateDisabledPersonRequest, 'province' | 'city' | 'district'> & {
  provinceId?: number;
  cityId?: number;
  districtId?: number;
};