namespace Baya.Infrastructure.Persistence.Configuration.VerificationConfig;

using Baya.Domain.Entities.Verification;

/// <summary>
/// The six MVP pipeline step-types, seeded via <c>HasData</c> so the data-driven pipeline exists on a fresh
/// DB (the b1 seeding path). Ids are fixed and deterministic (1…6, sort_order = id) so re-running is
/// idempotent and the model snapshot stays stable. A new regulatory step is one more row — never a code
/// enum. Emitted in its own "seed" migration, separate from the table-creation migration.
/// </summary>
internal static class VerificationStepTypeSeed
{
    private static readonly (long Id, string Code, string Display, string Description, bool Required, bool Automated, string Provider)[] Rows =
    [
        (1, VerificationStepTypeCodes.IdentityKyc, "Identity Verification (KYC)",
            "National-ID validity, name match and photo/video liveness via an Iranian e-KYC vendor.",
            true, true, AutomationProviders.IdentityKycVendor),
        (2, VerificationStepTypeCodes.ShahkarMatch, "Shahkar Phone Binding",
            "Confirms the login SIM is registered to the nurse's own national ID (شاهکار).",
            true, true, AutomationProviders.Shahkar),
        (3, VerificationStepTypeCodes.MohCompetencyLicense, "MoH Professional Competency License",
            "پروانه صلاحیت حرفه‌ای — the MoH-mandated in-home nursing licence (bundles the criminal-record screen). Manual today.",
            true, false, null),
        (4, VerificationStepTypeCodes.InoMembership, "Nursing Organization (INO) Membership",
            "نظام پرستاری membership cross-check (ino.ir). Manual today.",
            true, false, null),
        (5, VerificationStepTypeCodes.CriminalRecord, "Criminal Record Certificate",
            "عدم سوء پیشینه — consent-gated, nurse-uploaded, time-limited (reverts on expiry).",
            true, false, null),
        (6, VerificationStepTypeCodes.BankAccountVerification, "Bank Account (IBAN) Ownership",
            "استعلام شبا — the payout IBAN owner's national ID must equal the verified nurse national ID.",
            true, true, AutomationProviders.Sheba),
    ];

    public static object[] StepTypes()
    {
        var ts = SeedConstants.Timestamp;
        return Rows
            .Select(r => (object)new
            {
                r.Id,
                r.Code,
                DisplayName = r.Display,
                Description = (string)r.Description,
                IsRequired = r.Required,
                IsAutomated = r.Automated,
                AutomationProvider = r.Provider,
                SortOrder = (int)r.Id,
                IsActive = true,
                CreatedAt = ts
            })
            .ToArray();
    }
}
