package models

import "time"

type UserNotification struct {
	ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
	UserID uint `gorm:"column:userId;not null;index" json:"userId"`
	Title string `gorm:"column:title;type:varchar(255);not null" json:"title"`
	Description string `gorm:"column:description;type:varchar(255);not null" json:"description"`
	NotificationID *uint `gorm:"column:notificationId" json:"notificationId"`
	ChatRequestID *int `gorm:"column:chatRequestId" json:"chatRequestId"`
	CallRequestID *int `gorm:"column:callRequestId" json:"callRequestId"`
	IsActive bool `gorm:"column:isActive;default:true" json:"isActive"`
	IsDelete bool `gorm:"column:isDelete;default:false" json:"isDelete"`
	NotificationType int `gorm:"column:notification_type;default:0" json:"notification_type"`
	IsRead bool `gorm:"column:is_read;default:false" json:"is_read"`
	ReadAt *time.Time `gorm:"column:read_at" json:"read_at"`
	DeletedAt *time.Time `gorm:"column:deleted_at" json:"deleted_at"`
	CreatedAt *time.Time `gorm:"column:created_at" json:"created_at"`
	UpdatedAt *time.Time `gorm:"column:updated_at" json:"updated_at"`
	CreatedBy int `gorm:"column:createdBy" json:"createdBy"`
	ModifiedBy int `gorm:"column:modifiedBy" json:"modifiedBy"`
	// Relations
	User User `gorm:"foreignKey:UserID;references:ID" json:"user"`
}

func (UserNotification) TableName() string {
	return "user_notifications"
}