package models

import "time"

type ChatRequest struct {
	ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
	UserID uint `gorm:"column:userId;not null;index" json:"userId"`
	AstrologerID uint `gorm:"column:astrologerId;not null;index" json:"astrologerId"`
	ChatStatus *string `gorm:"column:chatStatus;type:varchar(45)" json:"chatStatus"`
	ChannelName *string `gorm:"column:channelName;type:varchar(45)" json:"channelName"`
	SenderID *string `gorm:"column:senderId;type:varchar(45)" json:"senderId"`
	ReceiverID *string `gorm:"column:receiverId;type:varchar(45)" json:"receiverId"`
	Deduction *float64 `gorm:"column:deduction;type:double" json:"deduction"`
	ChatID *string `gorm:"column:chatId;type:varchar(400)" json:"chatId"`
	DeductionFromAstrologer *float64 `gorm:"column:deductionFromAstrologer;type:double" json:"deductionFromAstrologer"`
	TotalMin *string `gorm:"column:totalMin;type:varchar(45)" json:"totalMin"`
	ChatRate *string `gorm:"column:chatRate;type:varchar(45)" json:"chatRate"`
	ChatDuration *string `gorm:"column:chat_duration;type:varchar(255)" json:"chat_duration"`
	IsFreeSession *bool `gorm:"column:isFreeSession" json:"isFreeSession"`
	CreatedAt *time.Time `gorm:"column:created_at" json:"created_at"`
	UpdatedAt *time.Time `gorm:"column:updated_at" json:"updated_at"`
	// Relations
	User       User `gorm:"foreignKey:UserID;references:ID" json:"user"`
	Astrologer User `gorm:"foreignKey:AstrologerID;references:ID" json:"astrologer"`
}

func (ChatRequest) TableName() string {
	return "chatrequest"
}