package de.avatic.lcc.dto.generic;


import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Objects;

public class MaterialDTO {

    private Integer id;
    @JsonProperty("part_number")
    private String partNumber;
    private String name;

    @JsonProperty("hs_code")
    private String hsCode;

    @JsonProperty("is_deprecated")
    private Boolean isDeprecated;

    public MaterialDTO() {
    }

    public MaterialDTO(Integer id, String partNumber, String name, String hsCode) {
        this.id = id;
        this.partNumber = partNumber;
        this.name = name;
        this.hsCode = hsCode;
    }

    public String getHsCode() {
        return hsCode;
    }

    public void setHsCode(String hsCode) {
        this.hsCode = hsCode;
    }

    public Integer getId() {
        return id;
    }

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

    public String getPartNumber() {
        return partNumber;
    }

    public void setPartNumber(String partNumber) {
        this.partNumber = partNumber;
    }

    public String getName() {
        return name;
    }

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

    @JsonIgnore
    public Boolean getDeprecated() {
        return isDeprecated;
    }

    public void setDeprecated(Boolean deprecated) {
        isDeprecated = deprecated;
    }

    @Override
    public String toString() {
        return "MaterialSummaryDTO{" +
                "id='" + id + '\'' +
                ", partNumber='" + partNumber + '\'' +
                ", name='" + name + '\'' +
                '}';
    }

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

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

}
