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

// 区域响应类型
export type AreaResponse = InferResponseType<typeof areaClient.index.$get, 200>['data'][0];

// 创建区域请求类型
export type CreateAreaRequest = InferRequestType<typeof areaClient.index.$post>['json'];

// 更新区域请求类型
export type UpdateAreaRequest = InferRequestType<typeof areaClient[':id']['$put']>['json'];

// 树形节点类型
export interface AreaNode {
  id: number;
  tenantId: number;
  name: string;
  code: string;
  level: number;
  parentId: number | null;
  isDisabled: number;
  children?: AreaNode[];
}

// 区域表单数据类型
export interface AreaFormData {
  id?: number;
  parentId?: number;
  name: string;
  level: number;
  code: string;
  isDisabled?: number;
}

// 区域查询参数类型
export interface AreaQueryParams {
  page?: number;
  pageSize?: number;
  filters?: string;
  sortBy?: string;
  sortOrder?: 'ASC' | 'DESC';
}