import { BaseVO } from '../base'
import { BaseDTO } from '../base'

// ==================== DTO ====================

/**
 * 聊天室DTO
 */
export interface TbChatRoomDTO extends BaseDTO {
    roomId?: string
    workcaseId?: string
    roomName?: string
    roomType?: string
    status?: string
    guestId?: string
    guestName?: string
    deviceCode?: string
    commentLevel?: number
    aiSessionId?: string
    currentAgentId?: string
    agentCount?: number
    messageCount?: number
    unreadCount?: number
    lastMessageTime?: string
    lastMessage?: string
    closedBy?: string
    closedTime?: string
}

/**
 * 聊天消息DTO
 */
export interface TbChatRoomMessageDTO extends BaseDTO {
    messageId?: string
    roomId?: string
    senderId?: string
    senderType?: string
    senderName?: string
    messageType?: string
    content?: string
    files?: string[]
    contentExtra?: Record<string, any>
    replyToMsgId?: string
    isAiMessage?: boolean
    aiMessageId?: string
    status?: string
    readCount?: number
    sendTime?: string
}

/**
 * 聊天室成员DTO
 */
export interface TbChatRoomMemberDTO extends BaseDTO {
    memberId?: string
    roomId?: string
    userId?: string
    userType?: string
    userName?: string
    status?: string
    unreadCount?: number
    lastReadTime?: string
    lastReadMsgId?: string
    joinTime?: string
    leaveTime?: string
}

/**
 * 视频会议DTO
 */
export interface TbVideoMeetingDTO extends BaseDTO {
    meetingId?: string
    roomId?: string
    workcaseId?: string
    meetingName?: string
    meetingPassword?: string
    description?: string
    jwtToken?: string
    jitsiRoomName?: string
    jitsiServerUrl?: string
    status?: string
    creatorId?: string
    creatorType?: string
    creatorName?: string
    participantCount?: number
    maxParticipants?: number
    /** 预定开始时间 */
    startTime?: string
    /** 预定结束时间 */
    endTime?: string
    /** 提前入会时间（分钟） */
    advance?: number
    actualStartTime?: string
    actualEndTime?: string
    durationSeconds?: number
    iframeUrl?: string
    config?: Record<string, any>
}

/**
 * 会议参与记录DTO
 */
export interface TbMeetingParticipantDTO extends BaseDTO {
    participantId?: string
    meetingId?: string
    userId?: string
    userType?: string
    userName?: string
    joinTime?: string
    leaveTime?: string
    durationSeconds?: number
    isModerator?: boolean
    joinMethod?: string
    deviceInfo?: string
}

/**
 * 会议转录记录表数据对象DTO
 */
export interface TbMeetingTranscriptionDTO extends BaseDTO {
    /** 转录记录ID */
    transcriptionId?: string
    /** 会议ID */
    meetingId?: string
    /** 说话人ID */
    speakerId?: string
    /** 说话人名称 */
    speakerName?: string
    /** 说话人类型：guest-来客 agent-客服 */
    speakerType?: string
    /** 转录文本内容 */
    content?: string
    /** 原始转录结果 */
    contentRaw?: string
    /** 语言 */
    language?: string
    /** 识别置信度（0-1） */
    confidence?: number
    /** 语音开始时间 */
    speechStartTime?: string
    /** 语音结束时间 */
    speechEndTime?: string
    /** 语音时长（毫秒） */
    durationMs?: number
    /** 音频片段URL */
    audioUrl?: string
    /** 片段序号 */
    segmentIndex?: number
    /** 是否最终结果 */
    isFinal?: boolean
    /** 服务提供商 */
    serviceProvider?: string
}

// ==================== VO ====================

/**
 * 聊天室VO
 * 用于前端展示聊天室信息
 */
export interface ChatRoomVO extends BaseVO {
    roomId?: string
    workcaseId?: string
    roomName?: string
    roomType?: string
    status?: string
    guestId?: string
    guestName?: string
    commentLevel?: string
    deviceCode?: string
    aiSessionId?: string
    currentAgentId?: string
    currentAgentName?: string
    agentCount?: number
    messageCount?: number
    unreadCount?: number
    lastMessageTime?: string
    lastMessage?: string
    closedBy?: string
    closedByName?: string
    closedTime?: string
}

/**
 * 聊天消息VO
 * 用于前端展示聊天消息
 */
export interface ChatRoomMessageVO extends BaseVO {
    messageId?: string
    roomId?: string
    senderId?: string
    senderType?: string
    senderName?: string
    senderAvatar?: string
    messageType?: string
    content?: string
    files?: string[]
    fileCount?: number
    contentExtra?: Record<string, any>
    replyToMsgId?: string
    replyToMsgContent?: string
    isAiMessage?: boolean
    aiMessageId?: string
    status?: string
    readCount?: number
    sendTime?: string
}

/**
 * 聊天室成员VO
 * 用于前端展示聊天室成员信息
 */
export interface ChatMemberVO extends BaseVO {
    memberId?: string
    roomId?: string
    userId?: string
    userType?: string
    userName?: string
    userAvatar?: string
    status?: string
    unreadCount?: number
    lastReadTime?: string
    lastReadMsgId?: string
    joinTime?: string
    leaveTime?: string
}

/**
 * 视频会议VO
 * 用于前端展示Jitsi Meet会议信息
 */
/**
 * 视频会议VO
 * 用于前端展示Jitsi Meet会议信息
 */
export interface VideoMeetingVO extends BaseVO {
    meetingId?: string
    roomId?: string
    workcaseId?: string
    meetingName?: string
    meetingPassword?: string
    description?: string
    jwtToken?: string
    jitsiRoomName?: string
    jitsiServerUrl?: string
    status?: string
    creatorType?: string
    creatorName?: string
    participantCount?: number
    maxParticipants?: number
    // 预定开始时间
    startTime?: string 
    // 预定结束时间
    endTime?: string
    // 提前入会时间（分钟）
    advance?: number
    actualStartTime?: string
    actualEndTime?: string
    durationSeconds?: number
    durationFormatted?: string
    iframeUrl?: string
    config?: Record<string, any>
}

/**
 * 会议参与记录VO
 * 用于前端展示会议参与者信息
 */
export interface MeetingParticipantVO extends BaseVO {
    participantId?: string
    meetingId?: string
    userId?: string
    userType?: string
    userName?: string
    userAvatar?: string
    joinTime?: string
    leaveTime?: string
    durationSeconds?: number
    durationFormatted?: string
    isModerator?: boolean
    joinMethod?: string
    joinMethodName?: string
    deviceInfo?: string
    isOnline?: boolean
}

/**
 * 发送消息参数
 */
export interface SendMessageParam {
    roomId: string
    content: string
    files?: string[]
    messageType?: string
    replyToMsgId?: string
}

/**
 * 创建会议参数
 */
export interface CreateMeetingParam {
    roomId: string
    workcaseId: string
    startTime: string
    endTime: string
    advance?: number
    meetingName?: string
    meetingPassword?: string
    maxParticipants?: number
}

/**
 * 标记已读参数
 */
export interface MarkReadParam {
    roomId: string
    messageIds?: string[]
}

// ==================== 客服相关 ====================

/**
 * 客服人员DTO
 */
export interface TbCustomerServiceDTO extends BaseDTO {
    userId?: string
    username?: string
    userCode?: string
    status?: string
    skillTags?: string[]
    maxConcurrent?: number
    currentWorkload?: number
    totalServed?: number
    avgResponseTime?: number
    satisfactionScore?: number
}

/**
 * 客服人员VO
 */
export interface CustomerServiceVO extends BaseVO {
    userId?: string
    username?: string
    userCode?: string
    avatar?: string
    status?: string
    statusName?: string
    skillTags?: string[]
    maxConcurrent?: number
    currentWorkload?: number
    totalServed?: number
    avgResponseTime?: number
    avgResponseTimeFormatted?: string
    satisfactionScore?: number
    isAvailable?: boolean
}