package de.avatic.lcc.dto.configuration.material.view;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;
import java.util.Objects;

public class MaterialDetailDTO {
    private Integer id;

    @JsonProperty("part_number")
    private String partNumber;

    @JsonProperty("normalized_part_number")
    private String normalizedPartNumber;

    private String name;

    @JsonProperty("hs_code")
    private String hsCode;

    @JsonProperty("packaging")
    private List<MaterialDetailPackagingDTO> handlingUnits;

    @JsonProperty("is_deprecated")
    private boolean isDeprecated;

    public MaterialDetailDTO() {
    }

    public MaterialDetailDTO(Integer id, String partNumber, String name, String hs_code, List<MaterialDetailPackagingDTO> handling_units) {
        this.id = id;
        this.partNumber = partNumber;
        this.name = name;
        this.hsCode = hs_code;
        this.handlingUnits = handling_units;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @JsonProperty("part_number")
    public String getPartNumber() {
        return partNumber;
    }

    @JsonProperty("part_number")
    public void setPartNumber(String part_number) {
        this.partNumber = part_number;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @JsonProperty("hs_code")
    public String getHsCode() {
        return hsCode;
    }

    @JsonProperty("hs_code")
    public void setHsCode(String hsCode) {
        this.hsCode = hsCode;
    }

    @JsonProperty("packaging")
    public List<MaterialDetailPackagingDTO> getHandlingUnits() {
        return handlingUnits;
    }

    @JsonProperty("packaging")
    public void setHandlingUnits(List<MaterialDetailPackagingDTO> handlingUnits) {
        this.handlingUnits = handlingUnits;
    }

    @Override
    public String toString() {
        return "MaterialDetailDTO{" +
                "id='" + id + '\'' +
                ", part_number='" + partNumber + '\'' +
                ", name='" + name + '\'' +
                ", hs_code='" + hsCode + '\'' +
                ", handling_units=" + handlingUnits +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MaterialDetailDTO that = (MaterialDetailDTO) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(partNumber, that.partNumber) &&
                Objects.equals(name, that.name) &&
                Objects.equals(hsCode, that.hsCode) &&
                Objects.equals(handlingUnits, that.handlingUnits);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, partNumber, name, hsCode, handlingUnits);
    }

    public String getNormalizedPartNumber() {
        return normalizedPartNumber;
    }

    public void setNormalizedPartNumber(String normalizedPartNumber) {
        this.normalizedPartNumber = normalizedPartNumber;
    }

    @JsonProperty("is_deprecated")
    public boolean isDeprecated() {
        return isDeprecated;
    }

    @JsonProperty("is_deprecated")
    public void setDeprecated(boolean deprecated) {
        isDeprecated = deprecated;
    }
}