package dto

// The customer's side of the waiting queue. See docs/api_changes_2026_10_03.md.

type JoinQueueRequest struct {
	AstrologerID uint `json:"astrologer_id" binding:"required"`

	// CHAT, AUDIO or VIDEO. AUDIO and VIDEO queue as CALL.
	Medium string `json:"medium" binding:"required"`
}

type QueueActionRequest struct {
	QueueID uint `json:"queue_id" binding:"required"`
}

type QueueEntryResponse struct {
	QueueID         uint   `json:"queue_id"`
	AstrologerID    uint   `json:"astrologer_id"`
	AstrologerName  string `json:"astrologer_name"`
	AstrologerImage string `json:"astrologer_image"`
	WaitingType     string `json:"waiting_type"`
	Medium          string `json:"medium"`
	Status          string `json:"status"`
	EndReason       string `json:"end_reason,omitempty"`

	// 1-based place among the astrologer's active queue (chat and call
	// together). 0 once the row is no longer active.
	Position     int `json:"position"`
	TotalInQueue int `json:"total_in_queue"`

	RequestedAt      string `json:"requested_at"`
	WaitExpiresAt    string `json:"wait_expires_at,omitempty"`
	NotifiedAt       string `json:"notified_at,omitempty"`
	NotifyExpiresAt  string `json:"notify_expires_at,omitempty"`
	ConnectingAt     string `json:"connecting_at,omitempty"`
	ConnectExpiresAt string `json:"connect_expires_at,omitempty"`
	ConnectedAt      string `json:"connected_at,omitempty"`
	EndedAt          string `json:"ended_at,omitempty"`

	// Seconds until the deadline that applies to the current status, 0 when
	// none does.
	SecondsRemaining int `json:"seconds_remaining"`

	ConsultationID uint `json:"consultation_id,omitempty"`

	// What the app should do next: WAIT, CONNECT (tap Connect),
	// START_CONSULTATION (call /consultation/start) or NONE.
	NextAction string `json:"next_action"`
	Message    string `json:"message"`

	ServerTime          string `json:"server_time"`
	PollIntervalSeconds int    `json:"poll_interval_seconds"`
}

type QueueListResponse struct {
	List       []QueueEntryResponse `json:"list"`
	ServerTime string               `json:"server_time"`
}

// QueueSweepResult is the queue pass of the admin sweep.
type QueueSweepResult struct {
	Astrologers int `json:"astrologers"`
	Expired     int `json:"expired"`
	Notified    int `json:"notified"`
	Skipped     int `json:"skipped"`
	Rejected    int `json:"rejected"`
	Completed   int `json:"completed"`
}
