using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using AyCode.Interfaces.Entities;
using LinqToDB;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;

namespace FruitBank.Common.Entities
{
    public interface IStockQuantityHistoryExt : IEntityInt
    {
        public int StockQuantityHistoryId { get; set; }
        public double? NetWeightAdjustment { get; set; }
        public double? NetWeight { get; set; }
        public bool IsInconsistent { get; set; }
    }

    [AcBinarySerializable(false, true, false, true, false, false)]
    [Table(Name = FruitBankConstClient.StockQuantityHistoryExtDbTableName)]
    [System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.StockQuantityHistoryExtDbTableName)]
    [ToonDescription("Extended weight-metadata for StockQuantityHistory", Purpose = "Validates quantity deltas against measured weight to detect inconsistencies")]
    public sealed class StockQuantityHistoryExt : MgEntityBase, IStockQuantityHistoryExt
    {
        public int StockQuantityHistoryId { get; set; }

        [Column(DataType = DataType.DecFloat, CanBeNull = true)]
        public double? NetWeightAdjustment { get; set; }

        [Column(DataType = DataType.DecFloat, CanBeNull = true)]
        public double? NetWeight { get; set; }

        public bool IsInconsistent { get; set; }
    }
}
