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;

/**
 * Artists response container
 */
public class Artists {

    @JsonProperty("count")
    private Integer count;

    @JsonProperty("total_count")
    private Long totalCount;

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

    public Artists items(List<ArtistSimple> items) {
        this.items = items;
        return this;
    }

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

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

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

    public Artists 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;
    }

    /**
     * The total number of ``items`` returned by query
     *
     * @return total_count
     */
    public Long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Long totalCount) {
        this.totalCount = totalCount;
    }

    public Artists totalCount(Long totalCount) {
        this.totalCount = totalCount;
        return this;
    }

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

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

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

        sb.append("    items: ").append(toIndentedString(items)).append("\n");
        sb.append("    count: ").append(toIndentedString(count)).append("\n");
        sb.append("    totalCount: ").append(toIndentedString(totalCount)).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    ");
    }
}
