namespace JobTrackerApi.Services;

/// <summary>
/// Records the current table-creation owner while the legacy startup reconciler is retired in
/// migration-backed increments. This is a governance boundary, not a second schema definition.
/// A table must appear in exactly one creation set.
/// </summary>
internal static class StartupSchemaOwnership
{
    internal static readonly IReadOnlySet<string> MigrationOwnedTables = new HashSet<string>(StringComparer.Ordinal)
    {
        "AccountDeletionFiles",
        "AccountDeletionRequests",
        "AiUsageRecords",
        "AiWorkspaceNotes",
        "AiInteractions",
        "ApplicationChecklistItems",
        "AspNetRoleClaims",
        "AspNetRoles",
        "AspNetUserClaims",
        "AspNetUserLogins",
        "AspNetUserRoles",
        "AspNetUsers",
        "AspNetUserTokens",
        "Attachments",
        "CareerCertifications",
        "CareerEducations",
        "CareerExperiences",
        "CareerLanguages",
        "CareerProfiles",
        "CareerProfileVersions",
        "CareerProjects",
        "CareerSkills",
        "Companies",
        "Correspondences",
        "CoverLetterVersions",
        "CvExtractionRuns",
        "CvUploadArtifacts",
        "CvVariants",
        "CvVariantVersions",
        "EmailDrafts",
        "EmailSendAttempts",
        "GmailConnections",
        "GmailReviewDecisions",
        "ImapConnections",
        "InterviewPrepNotes",
        "InterviewPrepItems",
        "JobApplications",
        "JobEvents",
        "Jobs",
        "MicrosoftGraphConnections",
        "RuleSettings",
        "SystemEmailSettings",
        "TailoredCvDrafts",
        "TrustedDevices",
        "TwoFactorRecoveryCodes",
        "UserNotifications",
        "UserOperations",
        "UserRuleSettings",
        "UserSessions",
    };

    internal static readonly IReadOnlySet<string> ReconcilerOwnedTables = new HashSet<string>(StringComparer.Ordinal);

    // Historical migrations contain guarded compatibility bootstraps for these tables so direct
    // EF tooling can traverse the chain. The later adoption migration is the current owner.
    internal static readonly IReadOnlySet<string> MigrationCompatibilityBootstrapTables =
        new HashSet<string>(StringComparer.Ordinal) { "AspNetUsers" };
}
