package repository

import (
	"context"

	"gateway/internal/model/notification/domain/entity"
	"gateway/internal/model/notification/domain/enum"
)

// NotificationRepository persists notification outbox records.
type NotificationRepository interface {
	Insert(ctx context.Context, data *entity.Notification) error
	FindByID(ctx context.Context, tenantID, id string) (*entity.Notification, error)
	FindByIdempotency(ctx context.Context, tenantID string, kind enum.NotifyKind, idempotencyKey string) (*entity.Notification, error)
	UpdateDelivery(ctx context.Context, tenantID, id string, update *NotificationDeliveryUpdate) error
	NotificationIndexUP
}

// NotificationDeliveryUpdate is the partial update for delivery outcome.
type NotificationDeliveryUpdate struct {
	Status            enum.NotifyStatus
	Provider          string
	ProviderMessageID string
	LastError         string
	Attempts          int
	Body              string
	DeliveredAt       *int64
}

// NotificationIndexUP migrates notification collection indexes.
type NotificationIndexUP interface {
	Index20260520001UP(ctx context.Context) error
}
