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; } [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; } }