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

import com.fasterxml.jackson.annotation.JsonProperty;

import org.openapitools.jackson.nullable.JsonNullable;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Objects;

import io.delphiplatform.api.v3.decibelrdb.entity.DecibelProjectEntity;

public class DecibelProjectSimple {

    @JsonProperty("project_id")
    private String projectId;

    @JsonProperty("project_name")
    private String projectName;

    @JsonProperty("budget")
    private JsonNullable<BigDecimal> budget = JsonNullable.undefined();

    @JsonProperty("end_date")
    private LocalDate endDate;

    @JsonProperty("start_date")
    private LocalDate startDate;

    public static DecibelProjectSimple from(DecibelProjectEntity entity) {
        DecibelProjectSimple project = new DecibelProjectSimple();
        project.projectId(entity.getId());
        project.projectName(entity.getName());
        project.budget(entity.getBudget());
        project.setEndDate(entity.getEndDate());
        project.setStartDate(entity.getStartDate());
        return project;
    }

    public DecibelProjectSimple projectId(String projectId) {
        this.projectId = projectId;
        return this;
    }


    public String getProjectId() {
        return projectId;
    }

    public void setProjectId(String projectId) {
        this.projectId = projectId;
    }

    public DecibelProjectSimple projectName(String projectName) {
        this.projectName = projectName;
        return this;
    }


    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public DecibelProjectSimple budget(BigDecimal budget) {
        this.budget = JsonNullable.of(budget);
        return this;
    }


    public JsonNullable<BigDecimal> getBudget() {
        return budget;
    }

    public void setBudget(JsonNullable<BigDecimal> budget) {
        this.budget = budget;
    }

    public DecibelProjectSimple endDate(LocalDate endDate) {
        this.endDate = endDate;
        return this;
    }


    public LocalDate getEndDate() {
        return endDate;
    }

    public void setEndDate(LocalDate endDate) {
        this.endDate = endDate;
    }

    public DecibelProjectSimple startDate(LocalDate startDate) {
        this.startDate = startDate;
        return this;
    }


    public LocalDate getStartDate() {
        return startDate;
    }

    public void setStartDate(LocalDate startDate) {
        this.startDate = startDate;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        DecibelProjectSimple decibelProjectSimple = (DecibelProjectSimple) o;
        return Objects.equals(this.projectId, decibelProjectSimple.projectId) &&
            Objects.equals(this.projectName, decibelProjectSimple.projectName) &&
            Objects.equals(this.budget, decibelProjectSimple.budget) &&
            Objects.equals(this.endDate, decibelProjectSimple.endDate) &&
            Objects.equals(this.startDate, decibelProjectSimple.startDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(projectId, projectName, budget, endDate, startDate);
    }

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

        sb.append("    projectId: ").append(toIndentedString(projectId)).append("\n");
        sb.append("    projectName: ").append(toIndentedString(projectName)).append("\n");
        sb.append("    budget: ").append(toIndentedString(budget)).append("\n");
        sb.append("    endDate: ").append(toIndentedString(endDate)).append("\n");
        sb.append("    startDate: ").append(toIndentedString(startDate)).append("\n");
        sb.append("}");
        return sb.toString();
    }

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

