package models

import (
	"time"

	"github.com/google/uuid"
	"github.com/lib/pq"
)

type Notification struct {
	ID         uuid.UUID  `db:"id" json:"id"`
	TenantID   uuid.UUID  `db:"tenant_id" json:"tenant_id"`
	UserID     uuid.UUID  `db:"user_id" json:"user_id"`
	Type       string     `db:"type" json:"type"`
	EntityType *string    `db:"entity_type" json:"entity_type,omitempty"`
	EntityID   *uuid.UUID `db:"entity_id" json:"entity_id,omitempty"`
	Title      string     `db:"title" json:"title"`
	Body       *string    `db:"body" json:"body,omitempty"`
	SentAt     *time.Time `db:"sent_at" json:"sent_at,omitempty"`
	ReadAt     *time.Time `db:"read_at" json:"read_at,omitempty"`
	CreatedAt  time.Time  `db:"created_at" json:"created_at"`
}

type NotificationPreferences struct {
	UserID              uuid.UUID     `db:"user_id" json:"user_id"`
	TenantID            uuid.UUID     `db:"tenant_id" json:"tenant_id"`
	DeadlineReminderDays pq.Int64Array `db:"deadline_reminder_days" json:"deadline_reminder_days"`
	EmailEnabled        bool          `db:"email_enabled" json:"email_enabled"`
	DailyDigest         bool          `db:"daily_digest" json:"daily_digest"`
	CreatedAt           time.Time     `db:"created_at" json:"created_at"`
	UpdatedAt           time.Time     `db:"updated_at" json:"updated_at"`
}
