#nullable enable
namespace Baya.Application.Contracts.Common;

/// <summary>
/// Seam for verifying a professional credential (MoH پروانه صلاحیت حرفه‌ای, INO membership,
/// عدم سوء پیشینه) against its authoritative source. There is <b>no public B2B API</b> for MoH/INO today,
/// so the default implementation returns <see cref="CredentialVerificationStatus.RequiresManualReview"/>
/// (<c>verification_method = manual</c>) — the admin verifies the uploaded document against the official
/// portal. The interface is shaped so an <c>api</c>/<c>portal</c> implementation drops in later without
/// touching callers, keeping the audit-defensible <c>verification_method</c> honest.
/// </summary>
public interface ICredentialVerifier
{
    Task<CredentialVerificationResult> VerifyAsync(string credentialType, string? credentialNumber, CancellationToken cancellationToken = default);
}

/// <summary>Whether a credential can be verified automatically or needs a manual admin decision.</summary>
public enum CredentialVerificationStatus
{
    RequiresManualReview,
    Verified,
    Failed
}

/// <summary>Outcome of an <see cref="ICredentialVerifier"/> check.</summary>
/// <param name="Status">Manual today; automated once a portal/API is available.</param>
/// <param name="Method">The <c>verification_method</c> to record (<c>manual</c>/<c>portal</c>/<c>api</c>).</param>
/// <param name="ExternalResponseJson">Any raw source response, persisted for audit (null for manual).</param>
public readonly record struct CredentialVerificationResult(
    CredentialVerificationStatus Status,
    string Method,
    string? ExternalResponseJson);
