package entity

import (
	"gateway/internal/model/notification/domain/enum"

	"go.mongodb.org/mongo-driver/v2/bson"
)

// Notification is the outbound message audit / outbox record.
type Notification struct {
	ID                bson.ObjectID     `bson:"_id,omitempty"`
	TenantID          string            `bson:"tenant_id"`
	UID               string            `bson:"uid,omitempty"`
	Channel           enum.Channel      `bson:"channel"`
	Kind              enum.NotifyKind   `bson:"kind"`
	TargetHash        string            `bson:"target_hash"`
	TemplateKey       string            `bson:"template_key"`
	Locale            string            `bson:"locale"`
	Body              string            `bson:"body,omitempty"`
	Provider          string            `bson:"provider,omitempty"`
	ProviderMessageID string            `bson:"provider_message_id,omitempty"`
	Status            enum.NotifyStatus `bson:"status"`
	Attempts          int               `bson:"attempts"`
	LastError         string            `bson:"last_error,omitempty"`
	IdempotencyKey    string            `bson:"idempotency_key"`
	Severity          enum.Severity     `bson:"severity"`
	OccurredAt        *int64            `bson:"occurred_at,omitempty"`
	DeliveredAt       *int64            `bson:"delivered_at,omitempty"`
	CreateAt          *int64            `bson:"create_at,omitempty"`
	UpdateAt          *int64            `bson:"update_at,omitempty"`
}

func (n *Notification) CollectionName() string {
	return "notifications"
}
