using System.ComponentModel.DataAnnotations;
namespace GerbilManagerWebAPI.Models
{
///
/// 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.
///
public class SaleReservation
{
[Key]
public Guid Id { get; set; }
/// Loose reference (no FK) to the animal this status is about.
public Guid GerbilId { get; set; }
/// Captured animal name (survives an ingest wipe).
public string? GerbilName { get; set; }
///
/// Status: "verfuegbar" | "reserviert" | "abgegeben". Plain string, no FK —
/// keeps the row decoupled and ingest-surviving.
///
public string Status { get; set; } = "verfuegbar";
/// Loose reference (no FK) to the reserving/receiving contact (Interessent/Abnehmer), if any.
public Guid? ReservedForContactId { get; set; }
/// Captured contact name (survives an ingest wipe).
public string? ContactName { get; set; }
/// Planned hand-over appointment (RPRO3 abgeben_tb._TERMIN).
public DateTime? AppointmentDate { get; set; }
/// Agreed price (RPRO3 abstat_tb._PRICE).
public decimal? Price { get; set; }
/// Free-text note (RPRO3 _BEM).
public string? Note { get; set; }
/// When the animal was actually handed over (RPRO3 abstat_tb._AM); null until "abgegeben".
public DateTime? HandedOverDate { get; set; }
/// Server-side creation time.
public DateTimeOffset CreatedAt { get; set; }
/// Server-side last-update time.
public DateTimeOffset UpdatedAt { get; set; }
}
}