using GerbilManagerWebAPI.Models; namespace GerbilManagerWebAPI.Import.Rpro3 { /// /// Quelle eines RPRO3-Tier-Datensatzes. „stamm" = eigenes Tier, „fremd" = externer Ahn, /// „wurftier" = Welpe eines Wurfs (nur relevant, wenn nicht in ein stamm-Tier überführt). /// public enum Rpro3Src { Stamm, Fremd, Wurftier } /// Einheitlicher Tier-Datensatz aus der RPRO3-SQLite (vor Dedup). /// `Rid` ist die RPRO3-ID im jeweiligen Namensraum: "N"=stamm, "uN"=fremd, "XjY"=wurftier. public sealed class Rpro3Animal { public required string Rid { get; init; } public Rpro3Src Src { get; init; } public string? Name { get; set; } public Gender Gender { get; set; } public DateOnly? Dob { get; set; } public string? Farbe { get; set; } // _FARBE Farbschlagname public string? Fcode { get; set; } // _FCODE 8-Locus-Genotyp public string? Origin { get; set; } // aufgelöster Herkunfts-Name (herk_tb) public int? OriginHerkId { get; set; } // herk_tb.id (1 = eigene Zucht) public string? Zb { get; set; } public string? MidRaw { get; set; } // Mutter-Ref im RPRO3-Namensraum public string? PidRaw { get; set; } // Vater-Ref im RPRO3-Namensraum public DateOnly? DateOfDeath { get; set; } public string? CauseOfDeath { get; set; } public string? Defects { get; set; } // _FEHLER public bool IsCastrated { get; set; } public int? StatusCode { get; set; } // stamm._STATUS (RPRO3) // Dedup-Schlüssel (normalisiert), wird von Rpro3Dedup gesetzt. public string NameKey { get; set; } = ""; public string FarbeKey { get; set; } = ""; public string OriginKey { get; set; } = ""; } public sealed class Rpro3Litter { public required int Id { get; init; } public string? Name { get; set; } // _BEZ "Wurf A" public DateOnly? Date { get; set; } // _AM public string? MotherRid { get; set; } // stamm-id als string public string? FatherRid { get; set; } public string? Notes { get; set; } // _BEM } public sealed class Rpro3Pup { public required string Id { get; init; } // "XjY" public int WurfId { get; init; } public string? Name { get; set; } public Gender Gender { get; set; } public DateOnly? Dob { get; set; } public string? Sid { get; set; } // → stamm-id, falls als eigenes Tier behalten public DateOnly? DateOfDeath { get; set; } public string? CauseOfDeath { get; set; } public DateOnly? AbgabeDate { get; set; } public int? AbnId { get; set; } // → abn_tb public decimal? Price { get; set; } public string? Zb { get; set; } public string? Defects { get; set; } } public sealed class Rpro3Contact { public required int Id { get; init; } public required string Namespace { get; init; } // "herk" | "abn" public string? Bez { get; set; } public string? Anrede { get; set; } public string? Vname { get; set; } public string? Nname { get; set; } public string? Clan { get; set; } public string? Str { get; set; } public string? Ort { get; set; } public string? Plz { get; set; } public string? Telp { get; set; } public string? Teld { get; set; } public string? Mail { get; set; } public string? Http { get; set; } public string? Memo { get; set; } public string? Bem { get; set; } /// Anzeigename: Bezeichnung/Cattery, sonst Clan, sonst Vor+Nachname. public string DisplayName => FirstNonEmpty(Bez, Clan, $"{Vname} {Nname}".Trim()) ?? "Unbekannt"; private static string? FirstNonEmpty(params string?[] vals) => vals.FirstOrDefault(v => !string.IsNullOrWhiteSpace(v)); } public sealed class Rpro3Weight { public required string Tid { get; init; } // stamm-id (waage) bzw. wurftier-id (jungwaage) public DateOnly? Date { get; set; } public int Grams { get; set; } public string? Notes { get; set; } } public sealed class Rpro3Health { public required string Tid { get; init; } public DateOnly? Date { get; set; } public string? Description { get; set; } public string? Medication { get; set; } } public sealed class Rpro3Diary { public required string Tid { get; init; } public DateOnly? Date { get; set; } public string? Title { get; set; } public string? Description { get; set; } } public sealed class Rpro3PhotoSet { public required string Tid { get; init; } // stamm-id public List FileNames { get; } = new(); } /// Vollständig geparster RPRO3-Backup-Inhalt. public sealed class Rpro3Data { public List Animals { get; } = new(); // stamm + fremd public Dictionary Litters { get; } = new(); public Dictionary Pups { get; } = new(); public Dictionary HerkContacts { get; } = new(); public Dictionary AbnContacts { get; } = new(); public List Weights { get; } = new(); public List Health { get; } = new(); public List Diary { get; } = new(); public Dictionary Photos { get; } = new(); // Roh-Zählungen (vor Dedup) für den Report. public int ColorStammCount { get; set; } public int ColorExtCount { get; set; } /// Löst eine RPRO3-Ref ("N"/"uN"/"XjY") in einen Anzeigenamen auf (für Provenance/Report). public Func ResolveName { get; set; } = _ => null; } }