import { ApiProperty } from "@nestjs/swagger"

export class ChatMessageResponseDto {
  @ApiProperty({
    example: 123,
    description: "Unique identifier for the message",
  })
  id: number

  @ApiProperty({
    example: 101,
    description: "ID of the user who sent the message",
  })
  sender_id: number

  @ApiProperty({
    example: 202,
    description: "ID of the user who received the message",
  })
  receiver_id: number

  @ApiProperty({
    example: "Hello, I need to discuss the trip schedule",
    description: "Content of the message",
  })
  message: string

  @ApiProperty({
    example: false,
    description: "Whether the message has been read",
  })
  is_read: boolean

  @ApiProperty({
    example: "2025-01-15T10:30:00Z",
    description: "Timestamp when the message was created",
  })
  created_at: Date

  @ApiProperty({
    example: "2025-01-15T10:30:00Z",
    description: "Timestamp when the message was last updated",
  })
  updated_at: Date
}

export class ChatHistoryResponseDto {
  @ApiProperty({
    example: [123, 124, 125],
    description: "Array of message IDs in the chat history",
  })
  message_ids: number[]

  @ApiProperty({
    type: [ChatMessageResponseDto],
    description: "Array of chat messages",
  })
  messages: ChatMessageResponseDto[]

  @ApiProperty({
    example: 50,
    description: "Total number of messages available",
  })
  total_count: number

  @ApiProperty({
    example: 10,
    description: "Number of messages returned in this response",
  })
  returned_count: number
}

export class ChatConversationResponseDto {
  @ApiProperty({
    example: 456,
    description: "Unique identifier for the conversation",
  })
  id: number

  @ApiProperty({
    example: 101,
    description: "ID of the dispatcher in the conversation",
  })
  dispatcher_id: number

  @ApiProperty({
    example: 202,
    description: "ID of the driver in the conversation",
  })
  driver_id: number

  @ApiProperty({
    example: 2,
    description: "Number of unread messages for dispatcher",
  })
  dispatcher_unread_count: number

  @ApiProperty({
    example: 0,
    description: "Number of unread messages for driver",
  })
  driver_unread_count: number

  @ApiProperty({
    example: "2025-01-15T10:30:00Z",
    description: "Timestamp when the conversation was created",
  })
  created_at: Date

  @ApiProperty({
    example: "2025-01-15T10:30:00Z",
    description: "Timestamp when the conversation was last updated",
  })
  updated_at: Date
}

export class MarkMessagesReadResponseDto {
  @ApiProperty({
    example: true,
    description: "Whether the operation was successful",
  })
  success: boolean

  @ApiProperty({
    example: "Messages marked as read successfully",
    description: "Success message",
  })
  message: string
}
