package models

import "time"

type UserChat struct {
	ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
	ChatID int `gorm:"column:chatId;not null" json:"chatId"`
	UserID uint `gorm:"column:userId;not null;index" json:"userId"`
	AstrologerID uint `gorm:"column:astrologerId;not null;index" json:"astrologerId"`
	IsActive bool `gorm:"column:isActive;default:true" json:"isActive"`
	IsDelete bool `gorm:"column:isDelete;default:false" json:"isDelete"`
	CreatedAt *time.Time `gorm:"column:created_at" json:"created_at,omitempty"`
	UpdatedAt *time.Time `gorm:"column:updated_at" json:"updated_at,omitempty"`
	CreatedBy int `gorm:"column:createdBy;not null" json:"createdBy"`
	ModifiedBy int `gorm:"column:modifiedBy;not null" json:"modifiedBy"`
	// Relations
	User User `gorm:"foreignKey:UserID;references:ID" json:"user,omitempty"`
	Astrologer User `gorm:"foreignKey:AstrologerID;references:ID" json:"astrologer,omitempty"`
}

func (UserChat) TableName() string {
	return "user_chats"
}