/// <reference types="@dcloudio/types" />

declare module '*.vue' {
  import { DefineComponent } from 'vue';
  const component: DefineComponent<object, object, unknown>;
  export default component;
}

// 用户信息类型
export interface UserInfo {
  id: string;
  phone?: string;
  nickname: string;
  avatar: string;
  memberLevel: number;
  memberExpireAt?: string;
  dailyUsage?: number;
}

// 音频类型
export interface AudioItem {
  id?: string | number;  // 后端返回的id（章节用数字，AudioRecord用数字）
  _id: string;
  audioId?: string;      // TTS 生成的 UUID（AudioRecord 才有）
  userId: string;  // 添加用户 ID
  title: string;
  text: string;
  summary?: string;
  tags: string[];
  audioUrl: string;
  audioDuration: number;
  audioSize: number;
  wordCount: number;
  voiceId: string;
  voiceParams: VoiceParams;
  status: 'processing' | 'completed' | 'failed';
  isFavorite: boolean;
  isPublic?: boolean;    // 是否公开（2026-04-14 新增）
  isOwner?: boolean;     // 是否为当前用户所有
  lrcLyrics?: string;     // LRC 格式歌词时间轴（OPT-17）
  bookId?: number;        // 所属书籍ID
  progress?: number;      // 收听进度 0-100
  createdAt: string;
  updatedAt: string;
}

// 音色参数
export interface VoiceParams {
  speed: number;
  pitch: number;
  volume: number;
}

// 音色类型
export interface Voice {
  id: string;
  name: string;
  gender: 'male' | 'female';
  description: string;
  preview?: string;
}

// 会员状态
export interface MemberStatus {
  level: number;
  levelName: string;
  expireAt?: string;
  isValid: boolean;
  quota: {
    dailyLimit: number;
    dailyUsed: number;
    dailyRemaining: number;
    wordLimit: number;
  };
}

// API 响应
export interface ApiResponse<T = unknown> {
  code: number;
  message: string;
  data?: T;
}

// 分页结果
export interface PaginationResult<T> {
  list: T[];
  total: number;
  page: number;
  pageSize: number;
  totalPages: number;
}