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;

/**
 * ProductAllOf
 */
public class ProductAllOf {

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

    @JsonProperty("tracks")
    @Valid
    private List<TrackSimple> tracks = null;

    @JsonProperty("label")
    private Label label;

    public ProductAllOf artists(List<ArtistSimple> artists) {
        this.artists = artists;
        return this;
    }

    public ProductAllOf addArtistsItem(ArtistSimple artistsItem) {
        if (this.artists == null) {
            this.artists = new ArrayList<>();
        }
        this.artists.add(artistsItem);
        return this;
    }

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

    public void setArtists(List<ArtistSimple> artists) {
        this.artists = artists;
    }

    public ProductAllOf tracks(List<TrackSimple> tracks) {
        this.tracks = tracks;
        return this;
    }

    public ProductAllOf addTracksItem(TrackSimple tracksItem) {
        if (this.tracks == null) {
            this.tracks = new ArrayList<>();
        }
        this.tracks.add(tracksItem);
        return this;
    }

    /**
     * Get tracks
     *
     * @return tracks
     */
    @Valid
    public List<TrackSimple> getTracks() {
        return tracks;
    }

    public void setTracks(List<TrackSimple> tracks) {
        this.tracks = tracks;
    }

    public ProductAllOf label(Label label) {
        this.label = label;
        return this;
    }

    /**
     * Get label
     *
     * @return label
     */
    @Valid
    public Label getLabel() {
        return label;
    }

    public void setLabel(Label label) {
        this.label = label;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ProductAllOf productAllOf = (ProductAllOf) o;
        return Objects.equals(this.artists, productAllOf.artists) &&
            Objects.equals(this.tracks, productAllOf.tracks) &&
            Objects.equals(this.label, productAllOf.label);
    }

    @Override
    public int hashCode() {
        return Objects.hash(artists, tracks, label);
    }

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

        sb.append("    artists: ").append(toIndentedString(artists)).append("\n");
        sb.append("    tracks: ").append(toIndentedString(tracks)).append("\n");
        sb.append("    label: ").append(toIndentedString(label)).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    ");
    }
}
