using FruitBank.Common.Interfaces;
using Mango.Nop.Core.Dtos;
//using Nop.Core.Domain.Catalog;

namespace FruitBank.Common.Dtos;

//public class MeasuringProductDto : ProductDto, IMeasuringProductDto
//{
//    /// <summary>
//    /// Reference to StockQuantity, always equals!
//    /// </summary>
//    public int Quantity
//    {
//        get => StockQuantity; 
//        set => StockQuantity = value;
//    }

//    public double NetWeight { get; set; }
//    public bool IsMeasurable { get; set; }

//    public MeasuringProductDto() :base()
//    { }
//    public MeasuringProductDto(int productId) : base(productId)
//    { }
//    public MeasuringProductDto(Product product, IMeasuringAttributeValues? measuringAttributeValues)
//    {
//        CopyEntityValuesToDto(product, measuringAttributeValues);
//    }

//    public void CopyDtoValuesToEntity(Product entity, IMeasuringAttributeValues measuringAttributeValues)
//    {
//        base.CopyDtoValuesToEntity(entity);

//        measuringAttributeValues.Id = Id;
//        measuringAttributeValues.NetWeight = NetWeight;
//        measuringAttributeValues.IsMeasurable = IsMeasurable;
//    }

//    public void CopyEntityValuesToDto(Product entity, IMeasuringAttributeValues? measuringAttributeValues)
//    {
//        if (measuringAttributeValues != null && entity.Id != measuringAttributeValues.Id) 
//            throw new Exception($"MeasuringProductDto->CopyEntityValuesToDto(Product entity, IMeasuringAttributeValues measuringAttributeValues); entity.Id != measuringAttributeValues.Id; entityId: {entity.Id}; measuringAttributeValues.Id: {measuringAttributeValues.Id}");

//        base.CopyEntityValuesToDto(entity);

//        if (measuringAttributeValues == null) return;

//        NetWeight = measuringAttributeValues.NetWeight;
//        IsMeasurable = measuringAttributeValues.IsMeasurable;
//    }

//    public bool HasMeasuringValues() => Id > 0 && NetWeight > 0 && IsMeasurable;
//}
