import { hc } from 'hono/client'
import type {
  AuthRoutes, UserRoutes, RoleRoutes,
  FileRoutes, MembershipPlanRoutes, PaymentRoutes,
  TemplateRoutes, PublicTemplateRoutes, SettingsRoutes, PublicSettingsRoutes,
  DocumentsRoutes,
  SolutionDesignsRoutes
} from '@/server/api';
import { axiosFetch } from './utils/axios-fetch';

export const authClient = hc<AuthRoutes>('/', {
  fetch: axiosFetch,
}).api.v1.auth;

export const userClient = hc<UserRoutes>('/', {
  fetch: axiosFetch,
}).api.v1.users;

export const roleClient = hc<RoleRoutes>('/', {
  fetch: axiosFetch,
}).api.v1.roles;

export const fileClient = hc<FileRoutes>('/', {
  fetch: axiosFetch,
}).api.v1.files;

export const membershipPlanClient = hc<MembershipPlanRoutes>('/', {
  fetch: axiosFetch,
}).api.v1['membership-plans'];

export const paymentClient = hc<PaymentRoutes>('/', {
  fetch: axiosFetch,
}).api.v1.payments;

// 模板管理客户端（需要认证）
export const templateClient = hc<TemplateRoutes>('/', {
  fetch: axiosFetch,
}).api.v1.templates;

// 公共模板客户端（无需认证）
export const publicTemplateClient = hc<PublicTemplateRoutes>('/', {
  fetch: axiosFetch,
}).api.v1.public.templates;

// 系统设置客户端（需要认证）
export const settingsClient = hc<SettingsRoutes>('/', {
  fetch: axiosFetch,
}).api.v1.settings;

// 公共设置客户端（无需认证）
export const publicSettingsClient = hc<PublicSettingsRoutes>('/', {
  fetch: axiosFetch,
}).api.v1.public.settings;

// 文档处理客户端
export const documentsClient = hc<DocumentsRoutes>('/', {
  fetch: axiosFetch,
}).api.v1.documents;

// 方案设计客户端
export const solutionDesignsClient = hc<SolutionDesignsRoutes>('/', {
  fetch: axiosFetch,
}).api.v1['solution-designs'];