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.ExternalUserPartnerMapDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.ExternalUserPartnerMapDbTableName)]
[ToonDescription("Maps an external sender identity to a NopCommerce customer (partner)", Purpose = "One record per (ExternalUsername, CustomerId) pair. A single partner may have multiple mappings (e.g. one for Viber, one for email). Lookup is by ExternalUsername; first match wins.")]
public sealed class ExternalUserPartnerMapping : MgEntityBase
{
    [ToonDescription(Purpose = "The external identifier as it arrives in the API call (Viber user ID, email address, etc.). Indexed for fast lookup.")]
    public string ExternalUsername { get; set; } = string.Empty;

    [ToonDescription(Purpose = "FK to the NopCommerce Customer this external identity maps to.")]
    public int CustomerId { get; set; }

    [ToonDescription(Purpose = "Admin who created this mapping.")]
    public int CreatedByAdminId { get; set; }

    public DateTime CreatedOnUtc { get; set; }
}