/**
 * API 路径管理
 * 统一管理所有接口路径
 * 
 */
export class ApiPath {
  private constructor() {}

  // API 基础路径
  private static readonly _baseUrl = "/api";

  // ============ 功能模块分组 ============
  private static readonly _auth = `${ApiPath._baseUrl}/auth`;
  private static readonly _verify = `${ApiPath._baseUrl}/verify`;
  private static readonly _user = `${ApiPath._baseUrl}/user`;
  private static readonly _payment = `${ApiPath._baseUrl}/payment`;
  private static readonly _chat = `${ApiPath._baseUrl}/chat`;

  // ============ 认证相关 ============
  /** 发送验证码 */
  static readonly sendCode = `${ApiPath._verify}/send`;

  /** 邮箱密码登录 */
  static readonly emailLogin = `${ApiPath._auth}/login`;

  /** 注册 */
  static readonly register = `${ApiPath._auth}/register`;

  /** 设备自动登录 */
  static readonly guestLogin = `${ApiPath._auth}/guest`;

  /** Apple 登录 */
  static readonly appleLogin = `${ApiPath._auth}/login/apple`;

  /** Google 登录 */
  static readonly googleLogin = `${ApiPath._auth}/login/google`;

  /** Facebook 登录 */
  static readonly facebookLogin = `${ApiPath._auth}/login/facebook`;

  /** Facebook ID 登录（v7.0 新增） */
  static readonly facebookIdLogin = `${ApiPath._auth}/login/facebook/by-id`;

  /** 刷新 Token */
  static readonly refresh = `${ApiPath._auth}/refresh`;

  /** 退出登录 */
  static readonly logout = `${ApiPath._auth}/logout`;

  /** 获取当前用户信息 */
  static readonly getCurrentUser = `${ApiPath._auth}/me`;

  // ============ 用户相关 ============
  /** 获取用户统计信息 */
  static readonly userStats = `${ApiPath._user}/stats`;

  /** 获取个人信息（与 /auth/me 等价） */
  static readonly userProfile = `${ApiPath._user}/profile`;

  /** 更新个人信息 */
  static readonly updateProfile = `${ApiPath._user}/profile`;

  /** 上传头像 */
  static readonly userAvatar = `${ApiPath._user}/avatar`;

  /** 查询积分余额 */
  static readonly userCredits = `${ApiPath._user}/credits`;

  /** 查询积分操作历史 */
  static readonly userCreditsHistory = `${ApiPath._user}/credits/history`;

  /** 获取当前用户权益快照 */
  static readonly userEntitlements = `${ApiPath._user}/entitlements`;

  // ============ 支付相关 ============
  /** 创建充值订单 */
  static readonly paymentCreateOrder = `${ApiPath._payment}/create-order`;

  /** 查询订单状态 */
  static readonly paymentOrderStatus = `${ApiPath._payment}/order-status`;

  /** 获取商品套餐列表 */
  static readonly paymentPlans = `${ApiPath._payment}/plans`;

  /** 查询当前用户 VIP 状态 */
  static readonly paymentVipStatus = `${ApiPath._payment}/vip-status`;

  /** @deprecated PAYWALL_API 使用 paymentPlans。 */
  static readonly paymentProducts = ApiPath.paymentPlans;

  /** 申请退款 */
  static readonly paymentRefund = `${ApiPath._payment}/refund`;

  /** 获取商品详情路径 */
  static getPaymentProductDetail(productId: string): string {
    return `${ApiPath.paymentProducts}/${productId}`;
  }

  // ============ 聊天相关 ============
  /** 发送消息 */
  static readonly chatSend = `${ApiPath._chat}/send`;

  /** 获取聊天历史 */
  static readonly chatHistory = `${ApiPath._chat}/history`;

  /** 语音转文字（STT） */
  static readonly chatStt = `${ApiPath._chat}/stt`;

  /** 同步游客消息 */
  static readonly chatSync = `${ApiPath._chat}/sync`;

  /** 上传图片 */
  static readonly chatUploadImage = `${ApiPath._chat}/upload-image`;

  /** 解锁私密消息 */
  static readonly chatUnlockPrivate = `${ApiPath._chat}/unlock-private`;

  /** 一键解锁历史锁定消息 */
  static readonly chatUnlockHistory = `${ApiPath._chat}/unlock-history`;

  // ============ 数据看板相关 ============
  private static readonly _metrics = `${ApiPath._baseUrl}/metrics`;

  /** 上报 PWA 事件 */
  static readonly metricsPwaEvent = `${ApiPath._metrics}/pwa/event`;

  // ============ 数据上报相关（v7.0 新增） ============
  private static readonly _data = `${ApiPath._baseUrl}/data`;

  /** 上报用户信息 */
  static readonly reportUserInfo = `${ApiPath._data}/report-user-info`;
}
