public enum BatchType { PatientRegistration, EncounterSummary, VitalsSheet, LabResults, MedicationList, AllergyUpdate, Mixed }

public static class BatchTypeExtensions
{
    public static string ToDbString(this BatchType t) => t switch
    {
        BatchType.PatientRegistration => "PATIENT_REGISTRATION",
        BatchType.EncounterSummary    => "ENCOUNTER_SUMMARY",
        BatchType.VitalsSheet         => "VITALS_SHEET",
        BatchType.LabResults          => "LAB_RESULTS",
        BatchType.MedicationList      => "MEDICATION_LIST",
        BatchType.AllergyUpdate       => "ALLERGY_UPDATE",
        BatchType.Mixed               => "MIXED",
        _ => throw new ArgumentOutOfRangeException(nameof(t))
    };

    public static BatchType FromDbString(string v) => v switch
    {
        "PATIENT_REGISTRATION" => BatchType.PatientRegistration,
        "ENCOUNTER_SUMMARY"    => BatchType.EncounterSummary,
        "VITALS_SHEET"         => BatchType.VitalsSheet,
        "LAB_RESULTS"          => BatchType.LabResults,
        "MEDICATION_LIST"      => BatchType.MedicationList,
        "ALLERGY_UPDATE"       => BatchType.AllergyUpdate,
        "MIXED"                => BatchType.Mixed,
        _ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown batch type: '{v}'")
    };
}