package de.avatic.lcc.dto.calculation.edit.destination;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.Min;

public class DestinationUpdateDTO {

    @JsonProperty("annual_amount")
    @Min(value= 1,  message = "Amount must be greater than or equal 1")
    private Integer annualAmount;

    @JsonProperty("repackaging_costs")
    @DecimalMin(value = "0.00", message = "Repackaging cost must be greater than or equal 0")
    @Digits(integer = 13, fraction = 2, message = "Repackaging cost must have at most 2 decimal places")
    private Number repackingCost;

    @JsonProperty("handling_costs")
    @DecimalMin(value = "0.00", message = "Handling cost must be greater than or equal 0")
    @Digits(integer = 13, fraction = 2, message = "Handling cost must have at most 2 decimal places")
    private Number handlingCost;

    @JsonProperty("disposal_costs")
    @DecimalMin(value = "0.00", message = "Disposal cost must be greater than or equal 0")
    @Digits(integer = 13, fraction = 2, message = "Disposal cost must have at most 2 decimal places")
    private Number disposalCost;

    @JsonProperty("route_selected_id")
    @Min(1)
    private Integer routeSelectedId;

    @JsonProperty("is_d2d")
    private Boolean d2d;

    @DecimalMin(value = "0.00", message = "Rate must be greater than or equal 0")
    @Digits(integer = 13, fraction = 2, message = "Rate must have at most 2 decimal places")
    @JsonProperty("rate_d2d")
    private Number rateD2d;

    @Min(value = 0, message = "Lead time must be greater than or equal 0")
    @Digits(integer = 13, fraction = 2, message = "Lead time must have at most 2 decimal places")
    @JsonProperty("lead_time_d2d")
    private Integer leadtimeD2d;

    public Number getRepackingCost() {
        return repackingCost;
    }

    public void setRepackingCost(Number repackingCost) {
        this.repackingCost = repackingCost;
    }

    public Number getHandlingCost() {
        return handlingCost;
    }

    public void setHandlingCost(Number handlingCost) {
        this.handlingCost = handlingCost;
    }

    public Number getDisposalCost() {
        return disposalCost;
    }

    public void setDisposalCost(Number disposalCost) {
        this.disposalCost = disposalCost;
    }

    public Integer getRouteSelectedId() {
        return routeSelectedId;
    }

    public void setRouteSelectedId(Integer routeSelectedId) {
        this.routeSelectedId = routeSelectedId;
    }

    public Integer getAnnualAmount() {
        return annualAmount;
    }

    public void setAnnualAmount(Integer annualAmount) {
        this.annualAmount = annualAmount;
    }

    @JsonIgnore
    public Boolean getD2d() {
        return d2d;
    }

    public void setD2d(Boolean d2d) {
        this.d2d = d2d;
    }

    public Number getRateD2d() {
        return rateD2d;
    }

    public void setRateD2d(Number rateD2d) {
        this.rateD2d = rateD2d;
    }

    @Override
    public String toString() {
        return "DestinationUpdateDTO{" +
                "annualAmount=" + annualAmount +
                ", repackingCost=" + repackingCost +
                ", handlingCost=" + handlingCost +
                ", disposalCost=" + disposalCost +
                ", routeSelectedId=" + routeSelectedId +
                ", d2d=" + d2d +
                ", rateD2d=" + rateD2d +
                '}';
    }

    public Integer getLeadtimeD2d() {
        return leadtimeD2d;
    }

    public void setLeadtimeD2d(Integer leadtimeD2d) {
        this.leadtimeD2d = leadtimeD2d;
    }
}
