// IM 网关 - 类型定义

export interface IMMessage {
  id: string;
  channelType: string;     // 'feishu' | 'telegram' | 'qq' | 'wecom'
  channelId: string;       // 频道/群组 ID
  userId: string;
  userName?: string;
  content: string;
  contentType: 'text' | 'image' | 'file' | 'card';
  metadata?: Record<string, any>;
  timestamp: Date;
}

export interface IMSendOptions {
  channelType: string;
  channelId: string;
  userId?: string;
  content: string;
  contentType?: 'text' | 'card' | 'markdown';
  metadata?: Record<string, any>;
}

export type IMMessageHandler = (message: IMMessage) => void | Promise<void>;

export interface IMAdapter {
  name: string;
  connect(): Promise<void>;
  disconnect(): Promise<void>;
  send(options: IMSendOptions): Promise<void>;
  onMessage(handler: IMMessageHandler): void;
  isConnected(): boolean;
}
