/**
 * 工单/技术支持类型定义
 */

export interface Ticket {
  id: string;
  ticketNo: string;               // 工单编号
  title: string;                  // 标题
  content: string;                // 内容
  type: TicketType;               // 类型
  priority: TicketPriority;        // 优先级
  status: TicketStatus;           // 状态
  category: TicketCategory;        // 分类
  attachments: string[];          // 附件
  creatorId: string;
  creatorName: string;
  creatorAvatar: string;
  assigneeId?: string;
  assigneeName?: string;
  assigneeAvatar?: string;
  responseCount: number;          // 回复数
  solution?: string;               // 解决方案
  rating?: number;                 // 满意度评分
  feedback?: string;              // 反馈
  resolveTime?: number;            // 解决耗时(分钟)
  createTime: string;
  updateTime: string;
  resolveTime2?: string;           // 解决时间
}

export type TicketType = 'technical' | 'billing' | 'account' | 'feature' | 'bug' | 'other';

export type TicketPriority = 'low' | 'medium' | 'high' | 'urgent';

export type TicketStatus = 'pending' | 'processing' | 'waiting' | 'resolved' | 'closed' | 'rejected';

export type TicketCategory = 'api' | 'sdk' | 'payment' | 'account' | 'security' | 'integration' | 'other';

export interface TicketReply {
  id: string;
  ticketId: string;
  content: string;
  attachments: string[];
  isInternal: boolean;            // 是否为内部回复
  senderId: string;
  senderName: string;
  senderAvatar: string;
  senderRole: 'user' | 'support' | 'system';
  createTime: string;
}

export interface TicketTemplate {
  id: string;
  title: string;
  content: string;
  type: TicketType;
  category: TicketCategory;
  priority: TicketPriority;
}

export interface TicketStats {
  total: number;
  pending: number;
  processing: number;
  resolved: number;
  avgResponseTime: number;        // 平均响应时间(分钟)
  avgResolveTime: number;          // 平均解决时间(小时)
  satisfaction: number;            // 满意度
}

export interface FAQ {
  id: string;
  question: string;
  answer: string;
  category: string;
  viewCount: number;
  helpful: number;
  notHelpful: number;
  tags: string[];
  relatedQuestions: string[];
  createTime: string;
  updateTime: string;
}
