Files
GerbilManager/GerbilManagerWebAPI/Models/SaleReservation.cs

59 lines
2.5 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace GerbilManagerWebAPI.Models
{
/// <summary>
/// ABGABE-STATUS (RPRO3 abgeben_tb / abstat_tb): the pre-handover reservation/sale
/// pipeline for an animal — verfügbar (available) → reserviert (reserved) → abgegeben
/// (handed over). This is the *informal status* that precedes the legal sale contract
/// (SaleContract) — it does NOT replace it.
///
/// Deliberately decoupled from the rest of the model (same pattern as Feedback):
/// GerbilId and ReservedForContactId are plain nullable Guid columns, NOT enforced
/// foreign keys, so the import re-ingest wipe (IngestResolvedService) can delete and
/// recreate gerbils/contacts without deleting or breaking reservation rows. The
/// captured GerbilName/ContactName keep the row human-readable after a wipe.
/// </summary>
public class SaleReservation
{
[Key]
public Guid Id { get; set; }
/// <summary>Loose reference (no FK) to the animal this status is about.</summary>
public Guid GerbilId { get; set; }
/// <summary>Captured animal name (survives an ingest wipe).</summary>
public string? GerbilName { get; set; }
/// <summary>
/// Status: "verfuegbar" | "reserviert" | "abgegeben". Plain string, no FK —
/// keeps the row decoupled and ingest-surviving.
/// </summary>
public string Status { get; set; } = "verfuegbar";
/// <summary>Loose reference (no FK) to the reserving/receiving contact (Interessent/Abnehmer), if any.</summary>
public Guid? ReservedForContactId { get; set; }
/// <summary>Captured contact name (survives an ingest wipe).</summary>
public string? ContactName { get; set; }
/// <summary>Planned hand-over appointment (RPRO3 abgeben_tb._TERMIN).</summary>
public DateTime? AppointmentDate { get; set; }
/// <summary>Agreed price (RPRO3 abstat_tb._PRICE).</summary>
public decimal? Price { get; set; }
/// <summary>Free-text note (RPRO3 _BEM).</summary>
public string? Note { get; set; }
/// <summary>When the animal was actually handed over (RPRO3 abstat_tb._AM); null until "abgegeben".</summary>
public DateTime? HandedOverDate { get; set; }
/// <summary>Server-side creation time.</summary>
public DateTimeOffset CreatedAt { get; set; }
/// <summary>Server-side last-update time.</summary>
public DateTimeOffset UpdatedAt { get; set; }
}
}