namespace Baya.Application.Features.Identity;

/// <summary>Shared patient input rules used by the create/update validators.</summary>
internal static class PatientRules
{
    public static bool IsValidGender(string gender) => gender is "male" or "female";

    public static bool IsNotFuture(DateOnly birthDate) => birthDate <= DateOnly.FromDateTime(DateTime.UtcNow.Date);

    /// <summary>The care-recipient relation-to-payer code set. Null/empty means "unspecified".</summary>
    public static bool IsValidRelation(string relation)
        => string.IsNullOrEmpty(relation) || relation is "parent" or "spouse" or "child" or "self";

    /// <summary>Each condition is a short stable code; the list itself may be null/empty.</summary>
    public static bool AreValidConditions(IReadOnlyList<string> conditions)
        => conditions is null || conditions.All(c => !string.IsNullOrWhiteSpace(c) && c.Length <= 40);
}
