package io.delphiplatform.api.v3.model.ads;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Objects;

import io.delphiplatform.api.v3.decibelrdb.entity.DecibelCampaignEntity;
import io.delphiplatform.api.v3.decibelrdb.entity.DecibelCampaignObjectiveEntity;

public class Objective {

    @JsonProperty("objective_id")
    private Integer objectiveId;

    @JsonProperty("objective_name")
    private String objectiveName;

    public static Objective from(DecibelCampaignObjectiveEntity entity) {
        return new Objective()
            .objectiveId(entity.getId())
            .objectiveName(entity.getName());
    }

    public Objective objectiveId(Integer objectiveId) {
        this.objectiveId = objectiveId;
        return this;
    }


    public Integer getObjectiveId() {
        return objectiveId;
    }

    public void setObjectiveId(Integer objectiveId) {
        this.objectiveId = objectiveId;
    }

    public Objective objectiveName(String objectiveName) {
        this.objectiveName = objectiveName;
        return this;
    }


    public String getObjectiveName() {
        return objectiveName;
    }

    public void setObjectiveName(String objectiveName) {
        this.objectiveName = objectiveName;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Objective objective = (Objective) o;
        return Objects.equals(this.objectiveId, objective.objectiveId) &&
            Objects.equals(this.objectiveName, objective.objectiveName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(objectiveId, objectiveName);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class Objective {\n");

        sb.append("    objectiveId: ").append(toIndentedString(objectiveId)).append("\n");
        sb.append("    objectiveName: ").append(toIndentedString(objectiveName)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    private String toIndentedString(Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }
}

