// Chat module types

export interface ChatMessage {
  id: string
  content: string
  created_at: number
  sent: boolean
  pubkey: string
}

export interface ChatPeer {
  pubkey: string
  name?: string
  lastMessage?: ChatMessage
  unreadCount: number
  lastSeen: number
}

export interface NostrRelayConfig {
  url: string
  read?: boolean
  write?: boolean
}

export interface UnreadMessageData {
  lastReadTimestamp: number
  unreadCount: number
  processedMessageIds: Set<string>
}

export interface ChatConfig {
  maxMessages: number
  autoScroll: boolean
  showTimestamps: boolean
  notificationsEnabled: boolean
  soundEnabled: boolean
}

// Events emitted by chat module
export interface ChatEvents {
  'chat:message-received': {
    message: ChatMessage
    peerPubkey: string
  }
  'chat:message-sent': {
    message: ChatMessage
    peerPubkey: string
  }
  'chat:peer-added': {
    peer: ChatPeer
  }
  'chat:unread-count-changed': {
    peerPubkey: string
    count: number
    totalUnread: number
  }
}