38 lines
2.3 KiB
C#
38 lines
2.3 KiB
C#
using AyCode.Core.Serializers.Attributes;
|
|
using AyCode.Core.Serializers.Toons;
|
|
using LinqToDB.Mapping;
|
|
using Mango.Nop.Core.Entities;
|
|
|
|
namespace FruitBank.Common.Entities;
|
|
|
|
[AcBinarySerializable(false, true, false, true, false, false)]
|
|
[Table(Name = FruitBankConstClient.OrderDraftItemDbTableName)]
|
|
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.OrderDraftItemDbTableName)]
|
|
[ToonDescription("Single product line of an AI-parsed order draft", Purpose = "One requested product line within an OrderDraft. The AI resolves the raw product text to an ordered list of candidate NopCommerce products; the admin selects one before approval.")]
|
|
public sealed class OrderDraftItem : MgEntityBase
|
|
{
|
|
[ToonDescription(Purpose = "FK to the parent OrderDraft.")]
|
|
public int DraftId { get; set; }
|
|
|
|
[ToonDescription(Purpose = "The raw product text extracted from the message, as the sender wrote it (e.g. 'piros kalif', '20 rekesz citrom').")]
|
|
public string RawProductText { get; set; } = string.Empty;
|
|
|
|
[ToonDescription(Purpose = "The canonical product name as resolved by AI from RawProductText (e.g. 'Kaliforniai paprika piros'). For display purposes.")]
|
|
public string AiResolvedProductName { get; set; } = string.Empty;
|
|
|
|
[ToonDescription(Purpose = "Ordered JSON array of candidate NopCommerce Product IDs, best match first. Populated by AI + historical ProductTextMapping weighting.")]
|
|
public string SuggestedProductIdsJson { get; set; } = "[]";
|
|
|
|
[ToonDescription(Purpose = "The Product ID selected by the admin during review. Null until admin resolves this item.")]
|
|
public int? SelectedProductId { get; set; }
|
|
|
|
[ToonDescription(Purpose = "Quantity as parsed from the message text.", Constraints = "positive")]
|
|
public int RequestedQuantity { get; set; }
|
|
|
|
[ToonDescription(Purpose = "Whether this item should become a preorder item (true) or a direct order item (false). Computed from ParsedDeliveryDate of the parent draft: >4 days ahead = true.",
|
|
BusinessRule = "Set at creation time from parent draft's ParsedDeliveryDate. Not editable by admin.")]
|
|
public bool IsPreorder { get; set; }
|
|
|
|
[ToonDescription(Purpose = "Display order within the draft, matching the original message sequence.")]
|
|
public int SortOrder { get; set; }
|
|
} |