// 消息中心类型定义

// 消息类型
export type MessageType = 'sms' | 'email' | 'internal' | 'push';

// 消息状态
export type MessageStatus = 'pending' | 'sent' | 'failed' | 'read';

// 消息模板
export interface MessageTemplate {
  id: string;
  code: string;
  name: string;
  type: MessageType;
  subject?: string;
  content: string;
  variables: string[]; // 变量列表，如 ['username', 'code', 'time']
  isActive: boolean;
  description?: string;
  createdAt: string;
  updatedAt: string;
  createdBy?: string;
}

// 消息日志
export interface MessageLog {
  id: string;
  templateId?: string;
  templateName?: string;
  type: MessageType;
  recipient: string; // 接收人（手机号/邮箱/用户ID）
  recipientName?: string;
  subject?: string;
  content: string;
  status: MessageStatus;
  sentTime: string;
  readTime?: string;
  failReason?: string;
  retryCount: number;
  variables?: Record<string, any>;
}

// 消息发送记录
export interface MessageSendRecord {
  id: string;
  templateId: string;
  templateName: string;
  type: MessageType;
  recipients: string[];
  recipientCount: number;
  subject?: string;
  content: string;
  sendType: 'immediate' | 'scheduled';
  scheduledTime?: string;
  status: 'pending' | 'sending' | 'sent' | 'failed' | 'cancelled';
  sentCount?: number;
  failedCount?: number;
  sentAt?: string;
  createdAt: string;
  createdBy: string;
}