package models

import "time"

// AstrologerWaitingQueue is one customer's place in an astrologer's queue.
// The astrologer stack has its own copy over the same table.
type AstrologerWaitingQueue struct {
	ID            uint   `gorm:"primaryKey;column:id"`
	AstrologerID  uint   `gorm:"column:astrologer_id"`
	UserID        uint   `gorm:"column:user_id"`
	WaitingType   string `gorm:"column:waiting_type"` // CHAT or CALL
	Medium        string `gorm:"column:medium"`       // CHAT, AUDIO or VIDEO
	QueuePosition int    `gorm:"column:queue_position"`
	Status        string `gorm:"column:status"`

	RequestedAt      *time.Time `gorm:"column:requested_at"`
	WaitExpiresAt    *time.Time `gorm:"column:wait_expires_at"`
	NotifiedAt       *time.Time `gorm:"column:notified_at"`
	NotifyExpiresAt  *time.Time `gorm:"column:notify_expires_at"`
	ConnectingAt     *time.Time `gorm:"column:connecting_at"`
	ConnectExpiresAt *time.Time `gorm:"column:connect_expires_at"`
	ConnectedAt      *time.Time `gorm:"column:connected_at"`
	EndedAt          *time.Time `gorm:"column:ended_at"`
	EndReason        string     `gorm:"column:end_reason"`
	ConsultationID   *uint      `gorm:"column:consultation_id"`

	CreatedAt *time.Time `gorm:"column:created_at"`
	UpdatedAt *time.Time `gorm:"column:updated_at"`
}

func (AstrologerWaitingQueue) TableName() string {
	return "astrologer_waiting_queue"
}
