package io.delphiplatform.api.v3.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

import org.openapitools.jackson.nullable.JsonNullable;

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

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * Artist
 * @deprecated - Use {@link ArtistSimple}
 */
@Deprecated(forRemoval = true)
@JsonPropertyOrder(alphabetic = true)
public class Artist {

    @JsonProperty("artist_id")
    private String artistId;

    @JsonProperty("full_name")
    private String fullName;

    @JsonIgnore
    private String participNo;

    @JsonProperty("first_name")
    private JsonNullable<String> firstName = JsonNullable.undefined();

    @JsonProperty("last_name")
    private JsonNullable<String> lastName = JsonNullable.undefined();

    @JsonProperty("spotify_uri")
    private JsonNullable<URI> spotifyUri = JsonNullable.undefined();

    @JsonProperty("spotify_popularity")
    private JsonNullable<Integer> spotifyPopularity = JsonNullable.undefined();

    @JsonProperty("image")
    private JsonNullable<ImageSimple> image = JsonNullable.undefined();

    @JsonProperty("products")
    @Valid
    private List<ProductSimple> products = null;

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

    public Artist artistId(String artistId) {
        this.artistId = artistId;
        return this;
    }

    /**
     * Primary key identifier for Artist
     *
     * @return artistId
     */
    @NotNull
    public String getArtistId() {
        return artistId;
    }

    public void setArtistId(String artistId) {
        this.artistId = artistId;
    }

    public Artist fullName(String fullName) {
        this.fullName = fullName;
        return this;
    }

    /**
     * Get fullName
     *
     * @return fullName
     */
    @NotNull
    public String getFullName() {
        return fullName;
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    public Artist firstName(String firstName) {
        this.firstName = JsonNullable.of(firstName);
        return this;
    }

    /**
     * Get firstName
     *
     * @return firstName
     */
    public JsonNullable<String> getFirstName() {
        return firstName;
    }

    public void setFirstName(JsonNullable<String> firstName) {
        this.firstName = firstName;
    }

    public Artist lastName(String lastName) {
        this.lastName = JsonNullable.of(lastName);
        return this;
    }

    /**
     * Get lastName
     *
     * @return lastName
     */
    public JsonNullable<String> getLastName() {
        return lastName;
    }

    public void setLastName(JsonNullable<String> lastName) {
        this.lastName = lastName;
    }

    public Artist spotifyUri(URI spotifyUri) {
        this.spotifyUri = JsonNullable.of(spotifyUri);
        return this;
    }

    /**
     * Get spotifyUri
     *
     * @return spotifyUri
     */
    @Valid
    public JsonNullable<URI> getSpotifyUri() {
        return spotifyUri;
    }

    public void setSpotifyUri(JsonNullable<URI> spotifyUri) {
        this.spotifyUri = spotifyUri;
    }

    public Artist spotifyPopularity(Integer spotifyPopularity) {
        this.spotifyPopularity = JsonNullable.of(spotifyPopularity);
        return this;
    }

    /**
     * The popularity of a track is a value between 0 and 100, with 100 being the most popular. The popularity is
     * calculated by algorithm and is based, in the most part, on the total number of plays the track has had and how
     * recent those plays are. Generally speaking, songs that are being played a lot now will have a higher popularity
     * than songs that were played a lot in the past. Duplicate tracks (e.g. the same track from a single and an
     * product) are rated independently. Artist and album popularity is derived mathematically from track popularity.
     * Note that the popularity value may lag actual popularity by a few days: the value is not updated in real time.
     *
     * @return spotifyPopularity
     */
    public JsonNullable<Integer> getSpotifyPopularity() {
        return spotifyPopularity;
    }

    public void setSpotifyPopularity(JsonNullable<Integer> spotifyPopularity) {
        this.spotifyPopularity = spotifyPopularity;
    }

    public Artist participNo(String participNo) {
        this.participNo = participNo;
        return this;
    }

    public String getParticipNo() {
        return participNo;
    }

    public void setParticipNo(String participNo) {
        this.participNo = participNo;
    }

    public Artist image(ImageSimple image) {
        this.image = JsonNullable.of(image);
        return this;
    }

    /**
     * Get image
     *
     * @return image
     */
    @Valid
    public JsonNullable<ImageSimple> getImage() {
        return image;
    }

    public void setImage(JsonNullable<ImageSimple> image) {
        this.image = image;
    }

    public Artist products(List<ProductSimple> products) {
        this.products = products;
        return this;
    }

    public Artist addProductsItem(ProductSimple productsItem) {
        if (this.products == null) {
            this.products = new ArrayList<>();
        }
        this.products.add(productsItem);
        return this;
    }

    /**
     * Get products
     *
     * @return products
     */
    @Valid
    public List<ProductSimple> getProducts() {
        return products;
    }

    public void setProducts(List<ProductSimple> products) {
        this.products = products;
    }

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

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

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Artist artist = (Artist) o;
        return Objects.equals(this.artistId, artist.artistId) &&
            Objects.equals(this.fullName, artist.fullName) &&
            Objects.equals(this.firstName, artist.firstName) &&
            Objects.equals(this.lastName, artist.lastName) &&
            Objects.equals(this.spotifyUri, artist.spotifyUri) &&
            Objects.equals(this.spotifyPopularity, artist.spotifyPopularity) &&
            Objects.equals(this.image, artist.image) &&
            Objects.equals(this.products, artist.products) &&
            Objects.equals(this.tracks, artist.tracks);
    }

    @Override
    public int hashCode() {
        return Objects
            .hash(artistId, fullName, firstName, lastName, spotifyUri, spotifyPopularity, image, products, tracks);
    }

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

        sb.append("    artistId: ").append(toIndentedString(artistId)).append("\n");
        sb.append("    fullName: ").append(toIndentedString(fullName)).append("\n");
        sb.append("    firstName: ").append(toIndentedString(firstName)).append("\n");
        sb.append("    lastName: ").append(toIndentedString(lastName)).append("\n");
        sb.append("    spotifyUri: ").append(toIndentedString(spotifyUri)).append("\n");
        sb.append("    spotifyPopularity: ").append(toIndentedString(spotifyPopularity)).append("\n");
        sb.append("    image: ").append(toIndentedString(image)).append("\n");
        sb.append("    products: ").append(toIndentedString(products)).append("\n");
        sb.append("    tracks: ").append(toIndentedString(tracks)).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    ");
    }
}
