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

import com.fasterxml.jackson.annotation.JsonProperty;

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

import javax.validation.Valid;

/**
 * Projects response container
 */
public class Projects {

    @JsonProperty("count")
    private Integer count;

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

    @JsonProperty("next_cursor")
    private String nextCursor;

    public Projects nextCursor(String nextCursor) {
        this.nextCursor = nextCursor;
        return this;
    }

    public String getNextCursor() {
        return nextCursor;
    }

    public void setNextCursor(String nextCursor) {
        this.nextCursor = nextCursor;
    }


    public Projects items(List<Project> items) {
        this.items = items;
        return this;
    }

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

    /**
     * Get items
     *
     * @return items
     */

    @Valid
    public List<Project> getItems() {
        return items;
    }

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

    public Projects 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;
        }
        Projects projects = (Projects) o;
        return Objects.equals(this.items, projects.items) &&
            Objects.equals(this.count, projects.count);
    }

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

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class Projects {\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    ");
    }
}

