package model

import "time"

type ChatMessageReply struct {
	ID         string `json:"id"`
	SenderName string `json:"sender_name"`
	Content    string `json:"content"`
}

type ChatMessage struct {
	ID         string            `json:"id"`
	RoomID     string            `json:"room_id"`
	SenderID   string            `json:"sender_id"`
	ReceiverID string            `json:"receiver_id"`
	Content    string            `json:"content"`
	IsRead     bool              `json:"is_read"`
	ReadAt     *time.Time        `json:"read_at,omitempty"`
	ReplyToID  *string           `json:"reply_to_id,omitempty"`
	ReplyTo    *ChatMessageReply `json:"reply_to,omitempty"`
	CreatedAt  time.Time         `json:"created_at"`
}

type ChatRoom struct {
	ID            string     `json:"id"`
	Customer1ID   string     `json:"customer1_id"`
	Customer2ID   string     `json:"customer2_id"`
	LastMessage   string     `json:"last_message,omitempty"`
	LastMessageAt *time.Time `json:"last_message_at,omitempty"`
	CreatedAt     time.Time  `json:"created_at"`
}

type ChatMessageRequest struct {
	ReceiverID string  `json:"receiver_id"`
	Content    string  `json:"content"`
	ReplyToID  *string `json:"reply_to_id,omitempty"`
}

type ChatMessageResponse struct {
	Type    string       `json:"type"`
	Message *ChatMessage `json:"message,omitempty"`
	RoomID  string       `json:"room_id,omitempty"`
}

type ChatHistoryRequest struct {
	OtherCustomerID string `json:"other_customer_id"`
	Limit           int    `json:"limit"`
	Offset          int    `json:"offset"`
}
