using FruitBank.Common.Interfaces;
using System.Runtime;

namespace FruitBank.Common.Models;

public class MeasuringAttributeValues : IMeasuringAttributeValues
{
    public int Id { get; set; }

    public double NetWeight { get; set; } = int.MinValue;
    public bool IsMeasurable { get; set; } = false;

    public MeasuringAttributeValues()
    {
    }

    public MeasuringAttributeValues(int entityId, double netWeight, bool isMeasurable)
    {
        Initialize(entityId, netWeight, isMeasurable);
    }

    public void Initialize(int entityId, double netWeight, bool isMeasurable)
    {
        Id = entityId;
        NetWeight = netWeight;
        IsMeasurable = isMeasurable;
    }

    public bool HasMeasuringValues() => Id > 0 && NetWeight > int.MinValue && IsMeasurable;

    public override string ToString()
    {
        return $"EntityId: {Id}; NetWeight: {NetWeight}; IsMeasurable: {IsMeasurable}";
    }
}