// Tipos para o sistema de chat

export interface ChatSession {
  sessionId: string
  ticketId: string
  ticketRef: number
  ticketSubject: string
  agentName: string
  agentEmail?: string
  agentAvatarUrl?: string
  unreadCount: number
  lastActivityAt: number
  startedAt: number
}

export interface ChatMessage {
  id: string
  body: string
  authorName: string
  authorAvatarUrl?: string
  isFromMachine: boolean
  createdAt: number
  attachments: ChatAttachment[]
}

export interface ChatAttachment {
  storageId: string
  name: string
  size?: number
  type?: string
}

export interface ChatMessagesResponse {
  messages: ChatMessage[]
  hasSession: boolean
  unreadCount?: number
}

export interface SendMessageResponse {
  messageId: string
  createdAt: number
}

export interface SessionStartedEvent {
  session: ChatSession
}

export interface UnreadUpdateEvent {
  totalUnread: number
  sessions: ChatSession[]
}

export interface NewMessageEvent {
  totalUnread: number
  newCount: number
  sessions: ChatSession[]
}

export interface SessionEndedEvent {
  sessionId: string
  ticketId: string
}

export interface ChatHistorySession {
  sessionId: string
  startedAt: number
  endedAt: number | null
  agentName: string
  messages: ChatMessage[]
}
