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

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

import org.openapitools.jackson.nullable.JsonNullable;

import java.util.Objects;


/**
 * The YouTubeMetrics object contains all of the metrics fields, in addition to aggregated metrics of dimensions.
 */
@JsonPropertyOrder(alphabetic = true)
public class YouTubeMetrics {

    @JsonProperty("average_view_duration_percentage")
    private JsonNullable<Float> averageViewDurationPercentage = JsonNullable.undefined();

    @JsonProperty("average_view_duration_seconds")
    private JsonNullable<Float> averageViewDurationSeconds = JsonNullable.undefined();

    @JsonProperty("comments")
    private JsonNullable<Long> comments = JsonNullable.undefined();

    @JsonProperty("dislikes")
    private JsonNullable<Long> dislikes = JsonNullable.undefined();

    @JsonProperty("likes")
    private JsonNullable<Long> likes = JsonNullable.undefined();

    @JsonProperty("shares")
    private JsonNullable<Long> shares = JsonNullable.undefined();

    @JsonProperty("age_band_views_percentages")
    private JsonNullable<YouTubeAgeBands> ageBandViewsPercentages = JsonNullable.undefined();

    @JsonProperty("gender_views_percentages")
    private JsonNullable<YouTubeGenders> genderViewsPercentages = JsonNullable.undefined();

    @JsonProperty("traffic_source_types")
    private JsonNullable<YouTubeTrafficSourceTypes> trafficSourceTypes = JsonNullable.undefined();

    @JsonProperty("views")
    private JsonNullable<Long> views = JsonNullable.undefined();

    @JsonProperty("device_type")
    private JsonNullable<YouTubeDeviceType> deviceType = JsonNullable.undefined();

    @JsonProperty("operating_system")
    private JsonNullable<YouTubeOperatingSystem> operatingSystem = JsonNullable.undefined();

    public YouTubeMetrics averageViewDurationPercentage(Float averageViewDurationPercentage) {
        this.averageViewDurationPercentage = JsonNullable.of(averageViewDurationPercentage);
        return this;
    }

    /**
     * The average percentage of a video watched during a video playback. `null` if data is missing.
     *
     * @return averageViewDurationPercentage
     */
    public JsonNullable<Float> getAverageViewDurationPercentage() {
        return averageViewDurationPercentage;
    }

    public void setAverageViewDurationPercentage(JsonNullable<Float> averageViewDurationPercentage) {
        this.averageViewDurationPercentage = averageViewDurationPercentage;
    }

    public YouTubeMetrics averageViewDurationSeconds(Float averageViewDurationSeconds) {
        this.averageViewDurationSeconds = JsonNullable.of(averageViewDurationSeconds);
        return this;
    }

    /**
     * The average duration of video playbacks in seconds. `null` if data is missing.
     *
     * @return averageViewDurationSeconds
     */
    public JsonNullable<Float> getAverageViewDurationSeconds() {
        return averageViewDurationSeconds;
    }

    public void setAverageViewDurationSeconds(JsonNullable<Float> averageViewDurationSeconds) {
        this.averageViewDurationSeconds = averageViewDurationSeconds;
    }

    public YouTubeMetrics comments(Long comments) {
        this.comments = JsonNullable.of(comments);
        return this;
    }

    /**
     * Number of times users commented on a resource (e.g.: a video). `null` if data is missing.
     *
     * @return comments
     */
    public JsonNullable<Long> getComments() {
        return comments;
    }

    public void setComments(JsonNullable<Long> comments) {
        this.comments = comments;
    }

    public YouTubeMetrics dislikes(Long dislikes) {
        this.dislikes = JsonNullable.of(dislikes);
        return this;
    }

    /**
     * The number of times that users indicated they disliked a resource (e.g.: video, artist) by giving it a negative
     * rating. `null` if data is missing.
     *
     * @return dislikes
     */
    public JsonNullable<Long> getDislikes() {
        return dislikes;
    }

    public void setDislikes(JsonNullable<Long> dislikes) {
        this.dislikes = dislikes;
    }

    public YouTubeMetrics likes(Long likes) {
        this.likes = JsonNullable.of(likes);
        return this;
    }

    /**
     * The number of times that users indicated they liked a resource (e.g.: video, artist) by giving it a positive
     * rating. `null` if data is missing.
     *
     * @return likes
     */
    public JsonNullable<Long> getLikes() {
        return likes;
    }

    public void setLikes(JsonNullable<Long> likes) {
        this.likes = likes;
    }

    public YouTubeMetrics shares(Long shares) {
        this.shares = JsonNullable.of(shares);
        return this;
    }

    /**
     * The number of times that users shared a resource (e.g.: video) via share button. `null` if data is missing.
     *
     * @return shares
     */
    public JsonNullable<Long> getShares() {
        return shares;
    }

    public void setShares(JsonNullable<Long> shares) {
        this.shares = shares;
    }

    public YouTubeMetrics ageBandViewsPercentages(YouTubeAgeBands ageBandViewsPercentages) {
        this.ageBandViewsPercentages = JsonNullable.of(ageBandViewsPercentages);
        return this;
    }

    /**
     * Get ageBandViewsPercentages
     *
     * @return ageBandViewsPercentages
     */
    public JsonNullable<YouTubeAgeBands> getAgeBandViewsPercentages() {
        return ageBandViewsPercentages;
    }

    public void setAgeBandViewsPercentages(JsonNullable<YouTubeAgeBands> ageBandViewsPercentages) {
        this.ageBandViewsPercentages = ageBandViewsPercentages;
    }

    public YouTubeMetrics genderViewsPercentages(YouTubeGenders genderViewsPercentages) {
        this.genderViewsPercentages = JsonNullable.of(genderViewsPercentages);
        return this;
    }

    /**
     * Get genderViewsPercentages
     *
     * @return genderViewsPercentages
     */
    public JsonNullable<YouTubeGenders> getGenderViewsPercentages() {
        return genderViewsPercentages;
    }

    public void setGenderViewsPercentages(JsonNullable<YouTubeGenders> genderViewsPercentages) {
        this.genderViewsPercentages = genderViewsPercentages;
    }

    public YouTubeMetrics trafficSourceTypes(YouTubeTrafficSourceTypes trafficSourceTypes) {
        this.trafficSourceTypes = JsonNullable.of(trafficSourceTypes);
        return this;
    }

    /**
     * Get trafficSourceTypes
     *
     * @return trafficSourceTypes
     */
    public JsonNullable<YouTubeTrafficSourceTypes> getTrafficSourceTypes() {
        return trafficSourceTypes;
    }

    public void setTrafficSourceTypes(JsonNullable<YouTubeTrafficSourceTypes> trafficSourceTypes) {
        this.trafficSourceTypes = trafficSourceTypes;
    }

    public YouTubeMetrics views(Long views) {
        this.views = JsonNullable.of(views);
        return this;
    }

    /**
     * Number of times a resource (e.g.: a video) was viewed. `null` if data is missing.
     *
     * @return views
     */
    public JsonNullable<Long> getViews() {
        return views;
    }

    public void setViews(JsonNullable<Long> views) {
        this.views = views;
    }

    public YouTubeMetrics deviceType(YouTubeDeviceType deviceType) {
        this.deviceType = JsonNullable.of(deviceType);
        return this;
    }

    /**
     * Get deviceType
     *
     * @return deviceType
     */
    public JsonNullable<YouTubeDeviceType> getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(JsonNullable<YouTubeDeviceType> deviceType) {
        this.deviceType = deviceType;
    }

    public YouTubeMetrics operatingSystem(YouTubeOperatingSystem operatingSystem) {
        this.operatingSystem = JsonNullable.of(operatingSystem);
        return this;
    }

    /**
     * Get operatingSystem
     *
     * @return operatingSystem
     */
    public JsonNullable<YouTubeOperatingSystem> getOperatingSystem() {
        return operatingSystem;
    }

    public void setOperatingSystem(JsonNullable<YouTubeOperatingSystem> operatingSystem) {
        this.operatingSystem = operatingSystem;
    }


    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        YouTubeMetrics youTubeMetrics = (YouTubeMetrics) o;
        return Objects.equals(this.averageViewDurationPercentage, youTubeMetrics.averageViewDurationPercentage) &&
            Objects.equals(this.averageViewDurationSeconds, youTubeMetrics.averageViewDurationSeconds) &&
            Objects.equals(this.comments, youTubeMetrics.comments) &&
            Objects.equals(this.dislikes, youTubeMetrics.dislikes) &&
            Objects.equals(this.likes, youTubeMetrics.likes) &&
            Objects.equals(this.shares, youTubeMetrics.shares) &&
            Objects.equals(this.ageBandViewsPercentages, youTubeMetrics.ageBandViewsPercentages) &&
            Objects.equals(this.genderViewsPercentages, youTubeMetrics.genderViewsPercentages) &&
            Objects.equals(this.trafficSourceTypes, youTubeMetrics.trafficSourceTypes) &&
            Objects.equals(this.views, youTubeMetrics.views) &&
            Objects.equals(this.deviceType, youTubeMetrics.deviceType) &&
            Objects.equals(this.operatingSystem, youTubeMetrics.operatingSystem);
    }

    @Override
    public int hashCode() {
        return Objects
            .hash(averageViewDurationPercentage, averageViewDurationSeconds, comments, dislikes, likes, shares,
                ageBandViewsPercentages, genderViewsPercentages, trafficSourceTypes, views, deviceType,
                operatingSystem);
    }

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

        sb.append("    averageViewDurationPercentage: ").append(toIndentedString(averageViewDurationPercentage))
            .append("\n");
        sb.append("    averageViewDurationSeconds: ").append(toIndentedString(averageViewDurationSeconds)).append("\n");
        sb.append("    comments: ").append(toIndentedString(comments)).append("\n");
        sb.append("    dislikes: ").append(toIndentedString(dislikes)).append("\n");
        sb.append("    likes: ").append(toIndentedString(likes)).append("\n");
        sb.append("    shares: ").append(toIndentedString(shares)).append("\n");
        sb.append("    ageBandViewsPercentages: ").append(toIndentedString(ageBandViewsPercentages)).append("\n");
        sb.append("    genderViewsPercentages: ").append(toIndentedString(genderViewsPercentages)).append("\n");
        sb.append("    trafficSourceTypes: ").append(toIndentedString(trafficSourceTypes)).append("\n");
        sb.append("    views: ").append(toIndentedString(views)).append("\n");
        sb.append("    deviceType: ").append(toIndentedString(deviceType)).append("\n");
        sb.append("    operatingSystem: ").append(toIndentedString(operatingSystem)).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    ");
    }
}

