using System.ComponentModel.DataAnnotations;

namespace GerbilManagerWebAPI.Models
{
    /// <summary>
    /// ERWERB: how/when an animal was acquired (purchase date, price, note) — sourced from
    /// RennmausPro's <c>herktier_tb</c> (_TID/_DATE/_PRICE/_BEM). The seller is already linked
    /// via Gerbil.OriginContactId; this record adds the date/price/note around that.
    ///
    /// Decoupled from the rest of the model ON PURPOSE — GerbilId/SourceContactId are plain
    /// nullable Guid columns (NOT enforced foreign keys), so the import re-ingest wipe
    /// (IngestResolvedService, which deletes Gerbils/Contacts) never cascades into — or
    /// breaks — acquisition rows. They survive re-ingest, mirroring the Feedback pattern.
    /// </summary>
    public class AcquisitionRecord
    {
        [Key]
        public Guid Id { get; set; }

        /// <summary>Loose reference (no FK) to the acquired gerbil.</summary>
        public Guid? GerbilId { get; set; }

        /// <summary>Loose reference (no FK) to the source/seller contact, if known.</summary>
        public Guid? SourceContactId { get; set; }

        /// <summary>When the animal was acquired (purchase date).</summary>
        public DateOnly? Date { get; set; }

        /// <summary>Acquisition price (purchase cost), if recorded.</summary>
        public decimal? Price { get; set; }

        /// <summary>Free-text note about the acquisition.</summary>
        public string? Note { get; set; }

        /// <summary>Server-side creation time.</summary>
        public DateTimeOffset CreatedAt { get; set; }
    }
}
