package entity

import (
	"narasi-ahli-be/app/database/entity/users"
	"time"
)

type ChatParticipants struct {
	ID            uint       `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
	ChatSessionID uint       `json:"chat_session_id" gorm:"type:int4;not null;index"`
	UserID        uint       `json:"user_id" gorm:"type:int4;not null;index"`
	JoinedAt      time.Time  `json:"joined_at" gorm:"default:now()"`
	LeftAt        *time.Time `json:"left_at"`
	IsActive      bool       `json:"is_active" gorm:"default:true"`
	CreatedAt     time.Time  `json:"created_at" gorm:"default:now()"`
	UpdatedAt     time.Time  `json:"updated_at" gorm:"default:now()"`

	// Relationships
	ChatSession *ChatSessions `json:"chat_session" gorm:"foreignKey:ChatSessionID;references:ID"`
	User        *users.Users `json:"user" gorm:"foreignKey:UserID;references:ID"`
}
