package io.delphiplatform.api.v3.model;

import com.fasterxml.jackson.annotation.JsonProperty;

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

import javax.validation.Valid;

/**
 * Charts response container
 */
public class Charts {

    @JsonProperty("count")
    private Integer count;

    @JsonProperty("items")
    @Valid
    private List<Chart> items = null;

    public Charts items(List<Chart> items) {
        this.items = items;
        return this;
    }

    public Charts addItemsItem(Chart itemsItem) {
        if (this.items == null) {
            this.items = new ArrayList<>();
        }
        this.items.add(itemsItem);
        return this;
    }

    /**
     * Get items
     *
     * @return items
     */
    @Valid
    public List<Chart> getItems() {
        return items;
    }

    public void setItems(List<Chart> items) {
        this.items = items;
    }

    public Charts count(Integer count) {
        this.count = count;
        return this;
    }

    /**
     * The number of ``items`` returned in the response
     *
     * @return count
     */
    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Charts charts = (Charts) o;
        return Objects.equals(this.items, charts.items) &&
            Objects.equals(this.count, charts.count);
    }

    @Override
    public int hashCode() {
        return Objects.hash(items, count);
    }

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

        sb.append("    items: ").append(toIndentedString(items)).append("\n");
        sb.append("    count: ").append(toIndentedString(count)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces (except the first line).
     */
    private String toIndentedString(Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }
}
