package domain

import "time"

type DataIntegrityStatus string

const (
	DataIntegrityStatusPass    DataIntegrityStatus = "pass"
	DataIntegrityStatusWarning DataIntegrityStatus = "warning"
	DataIntegrityStatusFail    DataIntegrityStatus = "fail"
)

type DataIntegrityReport struct {
	Status    DataIntegrityStatus    `json:"status"`
	CheckedAt time.Time              `json:"checkedAt"`
	Summary   DataIntegritySummary   `json:"summary"`
	Sections  []DataIntegritySection `json:"sections"`
}

type DataIntegritySummary struct {
	TotalChecks int   `json:"totalChecks"`
	Passed      int   `json:"passed"`
	Warnings    int   `json:"warnings"`
	Failures    int64 `json:"failures"`
}

type DataIntegritySection struct {
	Key    string               `json:"key"`
	Label  string               `json:"label"`
	Status DataIntegrityStatus  `json:"status"`
	Checks []DataIntegrityCheck `json:"checks"`
}

type DataIntegrityCheck struct {
	Key         string              `json:"key"`
	Label       string              `json:"label"`
	Description string              `json:"description"`
	Status      DataIntegrityStatus `json:"status"`
	Severity    string              `json:"severity"`
	Count       int64               `json:"count"`
}

type OrphanUserLoginID struct {
	ID              string     `json:"id"`
	UserID          string     `json:"userId"`
	UserEmail       string     `json:"userEmail,omitempty"`
	UserDeletedAt   *time.Time `json:"userDeletedAt,omitempty"`
	TenantID        string     `json:"tenantId"`
	TenantSlug      string     `json:"tenantSlug,omitempty"`
	TenantDeletedAt *time.Time `json:"tenantDeletedAt,omitempty"`
	FieldKey        string     `json:"fieldKey"`
	LoginID         string     `json:"loginId"`
	Reasons         []string   `json:"reasons"`
}

type DeleteOrphanUserLoginIDsResult struct {
	DeletedCount int64               `json:"deletedCount"`
	Deleted      []OrphanUserLoginID `json:"deleted"`
	SkippedIDs   []string            `json:"skippedIds"`
}
