using CS2B_shipping_company.Exception;

namespace CS2B_shipping_company.Container;

public class FullContainer : BaseContainer
{
    private const float FeePerKg = 0.91f;
    private const float FridgePercentage = 0.08f;
    private const int MaxWeight = 20000;
    private int weight;
    
    public int Weight
    {
        get => weight;
        set
        {
            if (value > MaxWeight)
                throw new WeightExceededException($"Weight cannot exceed {MaxWeight}kg");
            weight = value;
        }
    }
    
    public bool IsRefrigerated { get; set; }
    
    public FullContainer(string description, string countryOfOrigin) 
        : base(description, countryOfOrigin) { }
    
    public override float Fee()
    {
        float fee = Weight * FeePerKg;
        if (IsRefrigerated)
            fee += fee * FridgePercentage;
        return fee;
    }
}