FruitBankHybridApp/FruitBank.Common/Entities/EkaerHistoryMapping.cs

30 lines
1.9 KiB
C#

using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using AyCode.Interfaces.TimeStampInfo;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
namespace FruitBank.Common.Entities;
[AcBinarySerializable(false, true, false, true, false, false)]
[ToonDescription("EkaerHistory ↔ source document/order junction (1:N)", Purpose = "Junction for the EKÁER declaration ↔ source relationship: one EkaerHistory can cover several inbound ShippingDocuments (grouped by Shipping + PartnerDepot) or a single outbound Order. ForeignKey is the source entity Id, interpreted via the parent EkaerHistory.IsOutgoing. Keeps the EKÁER link OUT of the core ShippingDocument/Order tables, so declarations can be deleted and regenerated without touching system data.")]
[Table(Name = FruitBankConstClient.EkaerHistoryMappingDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.EkaerHistoryMappingDbTableName)]
public sealed class EkaerHistoryMapping : MgEntityBase, ITimeStampInfo
{
[ToonDescription(Purpose = "The owning EKÁER declaration (EkaerHistory.Id).")]
public int EkaerHistoryId { get; set; }
[ToonDescription(Purpose = "Id of the covered source entity: ShippingDocument.Id when the parent EkaerHistory.IsOutgoing is false, Order id when true.")]
public int ForeignKey { get; set; }
[ToonDescription(Purpose = "Reserved for future PER-DOCUMENT detail. Currently NOT populated — the declaration-level summary (date + other party), being group-invariant, lives on EkaerHistory.ShippingDate + EkaerHistory.Partner instead. The column is kept for later document-specific notes.")]
public string? Comment { get; set; }
[Association(ThisKey = nameof(EkaerHistoryId), OtherKey = nameof(EkaerHistory.Id), CanBeNull = true)]
public EkaerHistory? EkaerHistory { get; set; }
public DateTime Created { get; set; }
public DateTime Modified { get; set; }
}