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

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

import org.openapitools.jackson.nullable.JsonNullable;

import java.time.LocalDate;
import java.util.Objects;

import io.delphiplatform.api.util.DateUtils;
import io.delphiplatform.api.v3.model.ArtistSimple;
import io.delphiplatform.api.v3.model.Region;

public class AdDimensions {

    @JsonProperty("ad_set")
    private JsonNullable<AdSet> adSet = JsonNullable.undefined();

    @JsonProperty("age_band")
    private JsonNullable<String> ageBand = JsonNullable.undefined();

    @JsonProperty("artist")
    private ArtistSimple artist;

    @JsonProperty("campaign")
    private JsonNullable<CampaignSimple> campaign = JsonNullable.undefined();

    private JsonNullable<LocalDate> chartweek = JsonNullable.undefined();

    @JsonProperty("date")
    private JsonNullable<LocalDate> date = JsonNullable.undefined();

    @JsonProperty("decibel_label")
    private JsonNullable<DecibelLabel> decibelLabel = JsonNullable.undefined();

    @JsonProperty("dsp")
    private JsonNullable<AdsDspSlug> dsp = JsonNullable.undefined();

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

    @JsonProperty("month")
    private JsonNullable<LocalDate> month = JsonNullable.undefined();

    @JsonProperty("objective")
    private JsonNullable<Objective> objective = JsonNullable.undefined();

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

    @JsonProperty("project")
    private JsonNullable<DecibelProjectSimple> project = JsonNullable.undefined();

    @JsonProperty("provider")
    private JsonNullable<Provider> provider = JsonNullable.undefined();

    @JsonProperty("region")
    private Region region;

    @JsonProperty("sub_category")
    private JsonNullable<SubCategory> subCategory = JsonNullable.undefined();

    @JsonProperty("category")
    private JsonNullable<Category> category = JsonNullable.undefined();

    private JsonNullable<LocalDate> week = JsonNullable.undefined();

    @JsonProperty("linkfire")
    private JsonNullable<LinkfireDimensions> linkfire = JsonNullable.undefined();

    @JsonProperty("week")
    public JsonNullable<Object> getWeekString() {
        if (week.isPresent() && week.get() != null) {
            return JsonNullable.of(DateUtils.formatWeek(week.get()));
        }
        return JsonNullable.undefined();
    }

    @JsonProperty("chartweek")
    public JsonNullable<Object> getChartweekString() {
        if (chartweek.isPresent() && chartweek.get() != null) {
            return JsonNullable.of(DateUtils.formatWeek(chartweek.get()));
        }
        return JsonNullable.undefined();
    }

    @JsonIgnore
    public LinkfireDimensions getLinkfireOrInit() {
        if (linkfire == null || !linkfire.isPresent()) {
            linkfire = JsonNullable.of(new LinkfireDimensions());
        }
        return linkfire.get();
    }

    public AdDimensions adSet(AdSet adSet) {
        this.adSet = JsonNullable.of(adSet);
        return this;
    }

    public JsonNullable<AdSet> getAdSet() {
        return adSet;
    }

    public void setAdSet(JsonNullable<AdSet> adSet) {
        this.adSet = adSet;
    }

    public AdDimensions ageBand(String ageBand) {
        this.ageBand = JsonNullable.of(ageBand);
        return this;
    }

    public JsonNullable<String> getAgeBand() {
        return ageBand;
    }

    public void setAgeBand(JsonNullable<String> ageBand) {
        this.ageBand = ageBand;
    }

    public AdDimensions artist(ArtistSimple artist) {
        this.artist = artist;
        return this;
    }

    public AdDimensions linkfire(LinkfireDimensions linkfire) {
        this.linkfire = JsonNullable.of(linkfire);
        return this;
    }

    public JsonNullable<LinkfireDimensions> getLinkfire() {
        return linkfire;
    }

    public void setLinkfire(JsonNullable<LinkfireDimensions> linkfire) {
        this.linkfire = linkfire;
    }

    public ArtistSimple getArtist() {
        return artist;
    }

    public void setArtist(ArtistSimple artist) {
        this.artist = artist;
    }

    public AdDimensions campaign(CampaignSimple campaign) {
        this.campaign = JsonNullable.of(campaign);
        return this;
    }

    public JsonNullable<CampaignSimple> getCampaign() {
        return campaign;
    }

    public void setCampaign(JsonNullable<CampaignSimple> campaign) {
        this.campaign = campaign;
    }

    public AdDimensions chartweek(LocalDate chartweek) {
        this.chartweek = JsonNullable.of(chartweek);
        return this;
    }

    public JsonNullable<LocalDate> getChartweek() {
        return chartweek;
    }

    public void setChartweek(JsonNullable<LocalDate> chartweek) {
        this.chartweek = chartweek;
    }

    public AdDimensions date(LocalDate date) {
        this.date = JsonNullable.of(date);
        return this;
    }


    public void setDate(JsonNullable<LocalDate> date) {
        this.date = date;
    }

    public AdDimensions decibelLabel(DecibelLabel decibelLabel) {
        this.decibelLabel = JsonNullable.of(decibelLabel);
        return this;
    }

    public JsonNullable<DecibelLabel> getDecibelLabel() {
        return decibelLabel;
    }

    public void setDecibelLabel(JsonNullable<DecibelLabel> decibelLabel) {
        this.decibelLabel = decibelLabel;
    }

    public AdDimensions dsp(AdsDspSlug dsp) {
        this.dsp = JsonNullable.of(dsp);
        return this;
    }

    public JsonNullable<AdsDspSlug> getDsp() {
        return dsp;
    }

    public void setDsp(JsonNullable<AdsDspSlug> dsp) {
        this.dsp = dsp;
    }

    public AdDimensions gender(String gender) {
        this.gender = JsonNullable.of(gender);
        return this;
    }

    public JsonNullable<String> getGender() {
        return gender;
    }

    public void setGender(JsonNullable<String> gender) {
        this.gender = gender;
    }

    public AdDimensions month(LocalDate month) {
        this.month = JsonNullable.of(month);
        return this;
    }

    public JsonNullable<LocalDate> getMonth() {
        return month;
    }

    public void setMonth(JsonNullable<LocalDate> month) {
        this.month = month;
    }

    public AdDimensions objective(Objective objective) {
        this.objective = JsonNullable.of(objective);
        return this;
    }

    public JsonNullable<Objective> getObjective() {
        return objective;
    }

    public void setObjective(JsonNullable<Objective> objective) {
        this.objective = objective;
    }

    public AdDimensions platform(String platform) {
        this.platform = JsonNullable.of(platform);
        return this;
    }

    public JsonNullable<String> getPlatform() {
        return platform;
    }

    public void setPlatform(JsonNullable<String> platform) {
        this.platform = platform;
    }

    public AdDimensions project(DecibelProjectSimple project) {
        this.project = JsonNullable.of(project);
        return this;
    }

    public JsonNullable<DecibelProjectSimple> getProject() {
        return project;
    }

    public void setProject(JsonNullable<DecibelProjectSimple> project) {
        this.project = project;
    }

    public AdDimensions provider(Provider provider) {
        this.provider = JsonNullable.of(provider);
        return this;
    }

    public JsonNullable<Provider> getProvider() {
        return provider;
    }

    public void setProvider(JsonNullable<Provider> provider) {
        this.provider = provider;
    }

    public AdDimensions region(Region region) {
        this.region = region;
        return this;
    }

    public Region getRegion() {
        return region;
    }

    public void setRegion(Region region) {
        this.region = region;
    }

    public AdDimensions subCategory(SubCategory subCategory) {
        this.subCategory = JsonNullable.of(subCategory);
        return this;
    }

    public JsonNullable<SubCategory> getSubCategory() {
        return subCategory;
    }

    public void setSubCategory(JsonNullable<SubCategory> subCategory) {
        this.subCategory = subCategory;
    }


    public AdDimensions category(Category category) {
        this.category = JsonNullable.of(category);
        return this;
    }

    public JsonNullable<Category> getCategory() {
        return category;
    }

    public void setCategory(JsonNullable<Category> category) {
        this.category = category;
    }

    public AdDimensions week(LocalDate week) {
        this.week = JsonNullable.of(week);
        return this;
    }

    public JsonNullable<LocalDate> getWeek() {
        return week;
    }

    public void setWeek(JsonNullable<LocalDate> week) {
        this.week = week;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        AdDimensions adDimensions = (AdDimensions) o;
        return Objects.equals(this.adSet, adDimensions.adSet) &&
            Objects.equals(this.ageBand, adDimensions.ageBand) &&
            Objects.equals(this.artist, adDimensions.artist) &&
            Objects.equals(this.campaign, adDimensions.campaign) &&
            Objects.equals(this.chartweek, adDimensions.chartweek) &&
            Objects.equals(this.date, adDimensions.date) &&
            Objects.equals(this.decibelLabel, adDimensions.decibelLabel) &&
            Objects.equals(this.dsp, adDimensions.dsp) &&
            Objects.equals(this.gender, adDimensions.gender) &&
            Objects.equals(this.month, adDimensions.month) &&
            Objects.equals(this.objective, adDimensions.objective) &&
            Objects.equals(this.platform, adDimensions.platform) &&
            Objects.equals(this.project, adDimensions.project) &&
            Objects.equals(this.provider, adDimensions.provider) &&
            Objects.equals(this.region, adDimensions.region) &&
            Objects.equals(this.subCategory, adDimensions.subCategory) &&
            Objects.equals(this.linkfire, adDimensions.linkfire) &&
            Objects.equals(this.week, adDimensions.week);
    }

    @Override
    public int hashCode() {
        return Objects
            .hash(adSet, ageBand, artist, campaign, chartweek, date, decibelLabel, dsp, gender, month, objective,
                platform, project, provider, region, subCategory,linkfire, week);
    }

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

        sb.append("    adSet: ").append(toIndentedString(adSet)).append("\n");
        sb.append("    ageBand: ").append(toIndentedString(ageBand)).append("\n");
        sb.append("    artist: ").append(toIndentedString(artist)).append("\n");
        sb.append("    campaign: ").append(toIndentedString(campaign)).append("\n");
        sb.append("    chartweek: ").append(toIndentedString(chartweek)).append("\n");
        sb.append("    date: ").append(toIndentedString(date)).append("\n");
        sb.append("    decibelLabel: ").append(toIndentedString(decibelLabel)).append("\n");
        sb.append("    dsp: ").append(toIndentedString(dsp)).append("\n");
        sb.append("    gender: ").append(toIndentedString(gender)).append("\n");
        sb.append("    month: ").append(toIndentedString(month)).append("\n");
        sb.append("    objective: ").append(toIndentedString(objective)).append("\n");
        sb.append("    platform: ").append(toIndentedString(platform)).append("\n");
        sb.append("    project: ").append(toIndentedString(project)).append("\n");
        sb.append("    provider: ").append(toIndentedString(provider)).append("\n");
        sb.append("    region: ").append(toIndentedString(region)).append("\n");
        sb.append("    subCategory: ").append(toIndentedString(subCategory)).append("\n");
        sb.append("    linkfire: ").append(toIndentedString(linkfire)).append("\n");
        sb.append("    week: ").append(toIndentedString(week)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    private String toIndentedString(Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }
}

