/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ package dev.plexapi.sdk.models.operations; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import dev.plexapi.sdk.utils.LazySingletonValue; import dev.plexapi.sdk.utils.Utils; import java.lang.Boolean; import java.lang.Long; import java.lang.Override; import java.lang.String; import java.util.Objects; import java.util.Optional; public class PastSubscription { @JsonInclude(Include.ALWAYS) @JsonProperty("id") private Optional id; @JsonInclude(Include.ALWAYS) @JsonProperty("mode") private Optional mode; @JsonInclude(Include.ALWAYS) @JsonProperty("renewsAt") private Optional renewsAt; @JsonInclude(Include.ALWAYS) @JsonProperty("endsAt") private Optional endsAt; @JsonInclude(Include.NON_ABSENT) @JsonProperty("canceled") private Optional canceled; @JsonInclude(Include.NON_ABSENT) @JsonProperty("gracePeriod") private Optional gracePeriod; @JsonInclude(Include.NON_ABSENT) @JsonProperty("onHold") private Optional onHold; @JsonInclude(Include.NON_ABSENT) @JsonProperty("canReactivate") private Optional canReactivate; @JsonInclude(Include.NON_ABSENT) @JsonProperty("canUpgrade") private Optional canUpgrade; @JsonInclude(Include.NON_ABSENT) @JsonProperty("canDowngrade") private Optional canDowngrade; @JsonInclude(Include.NON_ABSENT) @JsonProperty("canConvert") private Optional canConvert; @JsonProperty("type") private String type; @JsonInclude(Include.ALWAYS) @JsonProperty("transfer") private Optional transfer; @JsonProperty("state") private PostUsersSignInDataState state; @JsonProperty("billing") private Billing billing; @JsonCreator public PastSubscription( @JsonProperty("id") Optional id, @JsonProperty("mode") Optional mode, @JsonProperty("renewsAt") Optional renewsAt, @JsonProperty("endsAt") Optional endsAt, @JsonProperty("canceled") Optional canceled, @JsonProperty("gracePeriod") Optional gracePeriod, @JsonProperty("onHold") Optional onHold, @JsonProperty("canReactivate") Optional canReactivate, @JsonProperty("canUpgrade") Optional canUpgrade, @JsonProperty("canDowngrade") Optional canDowngrade, @JsonProperty("canConvert") Optional canConvert, @JsonProperty("type") String type, @JsonProperty("transfer") Optional transfer, @JsonProperty("state") PostUsersSignInDataState state, @JsonProperty("billing") Billing billing) { Utils.checkNotNull(id, "id"); Utils.checkNotNull(mode, "mode"); Utils.checkNotNull(renewsAt, "renewsAt"); Utils.checkNotNull(endsAt, "endsAt"); Utils.checkNotNull(canceled, "canceled"); Utils.checkNotNull(gracePeriod, "gracePeriod"); Utils.checkNotNull(onHold, "onHold"); Utils.checkNotNull(canReactivate, "canReactivate"); Utils.checkNotNull(canUpgrade, "canUpgrade"); Utils.checkNotNull(canDowngrade, "canDowngrade"); Utils.checkNotNull(canConvert, "canConvert"); Utils.checkNotNull(type, "type"); Utils.checkNotNull(transfer, "transfer"); Utils.checkNotNull(state, "state"); Utils.checkNotNull(billing, "billing"); this.id = id; this.mode = mode; this.renewsAt = renewsAt; this.endsAt = endsAt; this.canceled = canceled; this.gracePeriod = gracePeriod; this.onHold = onHold; this.canReactivate = canReactivate; this.canUpgrade = canUpgrade; this.canDowngrade = canDowngrade; this.canConvert = canConvert; this.type = type; this.transfer = transfer; this.state = state; this.billing = billing; } public PastSubscription( String type, PostUsersSignInDataState state, Billing billing) { this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), type, Optional.empty(), state, billing); } @JsonIgnore public Optional id() { return id; } @JsonIgnore public Optional mode() { return mode; } @JsonIgnore public Optional renewsAt() { return renewsAt; } @JsonIgnore public Optional endsAt() { return endsAt; } @JsonIgnore public Optional canceled() { return canceled; } @JsonIgnore public Optional gracePeriod() { return gracePeriod; } @JsonIgnore public Optional onHold() { return onHold; } @JsonIgnore public Optional canReactivate() { return canReactivate; } @JsonIgnore public Optional canUpgrade() { return canUpgrade; } @JsonIgnore public Optional canDowngrade() { return canDowngrade; } @JsonIgnore public Optional canConvert() { return canConvert; } @JsonIgnore public String type() { return type; } @JsonIgnore public Optional transfer() { return transfer; } @JsonIgnore public PostUsersSignInDataState state() { return state; } @JsonIgnore public Billing billing() { return billing; } public final static Builder builder() { return new Builder(); } public PastSubscription withId(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); return this; } public PastSubscription withId(Optional id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } public PastSubscription withMode(String mode) { Utils.checkNotNull(mode, "mode"); this.mode = Optional.ofNullable(mode); return this; } public PastSubscription withMode(Optional mode) { Utils.checkNotNull(mode, "mode"); this.mode = mode; return this; } public PastSubscription withRenewsAt(long renewsAt) { Utils.checkNotNull(renewsAt, "renewsAt"); this.renewsAt = Optional.ofNullable(renewsAt); return this; } public PastSubscription withRenewsAt(Optional renewsAt) { Utils.checkNotNull(renewsAt, "renewsAt"); this.renewsAt = renewsAt; return this; } public PastSubscription withEndsAt(long endsAt) { Utils.checkNotNull(endsAt, "endsAt"); this.endsAt = Optional.ofNullable(endsAt); return this; } public PastSubscription withEndsAt(Optional endsAt) { Utils.checkNotNull(endsAt, "endsAt"); this.endsAt = endsAt; return this; } public PastSubscription withCanceled(boolean canceled) { Utils.checkNotNull(canceled, "canceled"); this.canceled = Optional.ofNullable(canceled); return this; } public PastSubscription withCanceled(Optional canceled) { Utils.checkNotNull(canceled, "canceled"); this.canceled = canceled; return this; } public PastSubscription withGracePeriod(boolean gracePeriod) { Utils.checkNotNull(gracePeriod, "gracePeriod"); this.gracePeriod = Optional.ofNullable(gracePeriod); return this; } public PastSubscription withGracePeriod(Optional gracePeriod) { Utils.checkNotNull(gracePeriod, "gracePeriod"); this.gracePeriod = gracePeriod; return this; } public PastSubscription withOnHold(boolean onHold) { Utils.checkNotNull(onHold, "onHold"); this.onHold = Optional.ofNullable(onHold); return this; } public PastSubscription withOnHold(Optional onHold) { Utils.checkNotNull(onHold, "onHold"); this.onHold = onHold; return this; } public PastSubscription withCanReactivate(boolean canReactivate) { Utils.checkNotNull(canReactivate, "canReactivate"); this.canReactivate = Optional.ofNullable(canReactivate); return this; } public PastSubscription withCanReactivate(Optional canReactivate) { Utils.checkNotNull(canReactivate, "canReactivate"); this.canReactivate = canReactivate; return this; } public PastSubscription withCanUpgrade(boolean canUpgrade) { Utils.checkNotNull(canUpgrade, "canUpgrade"); this.canUpgrade = Optional.ofNullable(canUpgrade); return this; } public PastSubscription withCanUpgrade(Optional canUpgrade) { Utils.checkNotNull(canUpgrade, "canUpgrade"); this.canUpgrade = canUpgrade; return this; } public PastSubscription withCanDowngrade(boolean canDowngrade) { Utils.checkNotNull(canDowngrade, "canDowngrade"); this.canDowngrade = Optional.ofNullable(canDowngrade); return this; } public PastSubscription withCanDowngrade(Optional canDowngrade) { Utils.checkNotNull(canDowngrade, "canDowngrade"); this.canDowngrade = canDowngrade; return this; } public PastSubscription withCanConvert(boolean canConvert) { Utils.checkNotNull(canConvert, "canConvert"); this.canConvert = Optional.ofNullable(canConvert); return this; } public PastSubscription withCanConvert(Optional canConvert) { Utils.checkNotNull(canConvert, "canConvert"); this.canConvert = canConvert; return this; } public PastSubscription withType(String type) { Utils.checkNotNull(type, "type"); this.type = type; return this; } public PastSubscription withTransfer(String transfer) { Utils.checkNotNull(transfer, "transfer"); this.transfer = Optional.ofNullable(transfer); return this; } public PastSubscription withTransfer(Optional transfer) { Utils.checkNotNull(transfer, "transfer"); this.transfer = transfer; return this; } public PastSubscription withState(PostUsersSignInDataState state) { Utils.checkNotNull(state, "state"); this.state = state; return this; } public PastSubscription withBilling(Billing billing) { Utils.checkNotNull(billing, "billing"); this.billing = billing; return this; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PastSubscription other = (PastSubscription) o; return Objects.deepEquals(this.id, other.id) && Objects.deepEquals(this.mode, other.mode) && Objects.deepEquals(this.renewsAt, other.renewsAt) && Objects.deepEquals(this.endsAt, other.endsAt) && Objects.deepEquals(this.canceled, other.canceled) && Objects.deepEquals(this.gracePeriod, other.gracePeriod) && Objects.deepEquals(this.onHold, other.onHold) && Objects.deepEquals(this.canReactivate, other.canReactivate) && Objects.deepEquals(this.canUpgrade, other.canUpgrade) && Objects.deepEquals(this.canDowngrade, other.canDowngrade) && Objects.deepEquals(this.canConvert, other.canConvert) && Objects.deepEquals(this.type, other.type) && Objects.deepEquals(this.transfer, other.transfer) && Objects.deepEquals(this.state, other.state) && Objects.deepEquals(this.billing, other.billing); } @Override public int hashCode() { return Objects.hash( id, mode, renewsAt, endsAt, canceled, gracePeriod, onHold, canReactivate, canUpgrade, canDowngrade, canConvert, type, transfer, state, billing); } @Override public String toString() { return Utils.toString(PastSubscription.class, "id", id, "mode", mode, "renewsAt", renewsAt, "endsAt", endsAt, "canceled", canceled, "gracePeriod", gracePeriod, "onHold", onHold, "canReactivate", canReactivate, "canUpgrade", canUpgrade, "canDowngrade", canDowngrade, "canConvert", canConvert, "type", type, "transfer", transfer, "state", state, "billing", billing); } public final static class Builder { private Optional id = Optional.empty(); private Optional mode = Optional.empty(); private Optional renewsAt = Optional.empty(); private Optional endsAt = Optional.empty(); private Optional canceled; private Optional gracePeriod; private Optional onHold; private Optional canReactivate; private Optional canUpgrade; private Optional canDowngrade; private Optional canConvert; private String type; private Optional transfer = Optional.empty(); private PostUsersSignInDataState state; private Billing billing; private Builder() { // force use of static builder() method } public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); return this; } public Builder id(Optional id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } public Builder mode(String mode) { Utils.checkNotNull(mode, "mode"); this.mode = Optional.ofNullable(mode); return this; } public Builder mode(Optional mode) { Utils.checkNotNull(mode, "mode"); this.mode = mode; return this; } public Builder renewsAt(long renewsAt) { Utils.checkNotNull(renewsAt, "renewsAt"); this.renewsAt = Optional.ofNullable(renewsAt); return this; } public Builder renewsAt(Optional renewsAt) { Utils.checkNotNull(renewsAt, "renewsAt"); this.renewsAt = renewsAt; return this; } public Builder endsAt(long endsAt) { Utils.checkNotNull(endsAt, "endsAt"); this.endsAt = Optional.ofNullable(endsAt); return this; } public Builder endsAt(Optional endsAt) { Utils.checkNotNull(endsAt, "endsAt"); this.endsAt = endsAt; return this; } public Builder canceled(boolean canceled) { Utils.checkNotNull(canceled, "canceled"); this.canceled = Optional.ofNullable(canceled); return this; } public Builder canceled(Optional canceled) { Utils.checkNotNull(canceled, "canceled"); this.canceled = canceled; return this; } public Builder gracePeriod(boolean gracePeriod) { Utils.checkNotNull(gracePeriod, "gracePeriod"); this.gracePeriod = Optional.ofNullable(gracePeriod); return this; } public Builder gracePeriod(Optional gracePeriod) { Utils.checkNotNull(gracePeriod, "gracePeriod"); this.gracePeriod = gracePeriod; return this; } public Builder onHold(boolean onHold) { Utils.checkNotNull(onHold, "onHold"); this.onHold = Optional.ofNullable(onHold); return this; } public Builder onHold(Optional onHold) { Utils.checkNotNull(onHold, "onHold"); this.onHold = onHold; return this; } public Builder canReactivate(boolean canReactivate) { Utils.checkNotNull(canReactivate, "canReactivate"); this.canReactivate = Optional.ofNullable(canReactivate); return this; } public Builder canReactivate(Optional canReactivate) { Utils.checkNotNull(canReactivate, "canReactivate"); this.canReactivate = canReactivate; return this; } public Builder canUpgrade(boolean canUpgrade) { Utils.checkNotNull(canUpgrade, "canUpgrade"); this.canUpgrade = Optional.ofNullable(canUpgrade); return this; } public Builder canUpgrade(Optional canUpgrade) { Utils.checkNotNull(canUpgrade, "canUpgrade"); this.canUpgrade = canUpgrade; return this; } public Builder canDowngrade(boolean canDowngrade) { Utils.checkNotNull(canDowngrade, "canDowngrade"); this.canDowngrade = Optional.ofNullable(canDowngrade); return this; } public Builder canDowngrade(Optional canDowngrade) { Utils.checkNotNull(canDowngrade, "canDowngrade"); this.canDowngrade = canDowngrade; return this; } public Builder canConvert(boolean canConvert) { Utils.checkNotNull(canConvert, "canConvert"); this.canConvert = Optional.ofNullable(canConvert); return this; } public Builder canConvert(Optional canConvert) { Utils.checkNotNull(canConvert, "canConvert"); this.canConvert = canConvert; return this; } public Builder type(String type) { Utils.checkNotNull(type, "type"); this.type = type; return this; } public Builder transfer(String transfer) { Utils.checkNotNull(transfer, "transfer"); this.transfer = Optional.ofNullable(transfer); return this; } public Builder transfer(Optional transfer) { Utils.checkNotNull(transfer, "transfer"); this.transfer = transfer; return this; } public Builder state(PostUsersSignInDataState state) { Utils.checkNotNull(state, "state"); this.state = state; return this; } public Builder billing(Billing billing) { Utils.checkNotNull(billing, "billing"); this.billing = billing; return this; } public PastSubscription build() { if (canceled == null) { canceled = _SINGLETON_VALUE_Canceled.value(); } if (gracePeriod == null) { gracePeriod = _SINGLETON_VALUE_GracePeriod.value(); } if (onHold == null) { onHold = _SINGLETON_VALUE_OnHold.value(); } if (canReactivate == null) { canReactivate = _SINGLETON_VALUE_CanReactivate.value(); } if (canUpgrade == null) { canUpgrade = _SINGLETON_VALUE_CanUpgrade.value(); } if (canDowngrade == null) { canDowngrade = _SINGLETON_VALUE_CanDowngrade.value(); } if (canConvert == null) { canConvert = _SINGLETON_VALUE_CanConvert.value(); } return new PastSubscription( id, mode, renewsAt, endsAt, canceled, gracePeriod, onHold, canReactivate, canUpgrade, canDowngrade, canConvert, type, transfer, state, billing); } private static final LazySingletonValue> _SINGLETON_VALUE_Canceled = new LazySingletonValue<>( "canceled", "false", new TypeReference>() {}); private static final LazySingletonValue> _SINGLETON_VALUE_GracePeriod = new LazySingletonValue<>( "gracePeriod", "false", new TypeReference>() {}); private static final LazySingletonValue> _SINGLETON_VALUE_OnHold = new LazySingletonValue<>( "onHold", "false", new TypeReference>() {}); private static final LazySingletonValue> _SINGLETON_VALUE_CanReactivate = new LazySingletonValue<>( "canReactivate", "false", new TypeReference>() {}); private static final LazySingletonValue> _SINGLETON_VALUE_CanUpgrade = new LazySingletonValue<>( "canUpgrade", "false", new TypeReference>() {}); private static final LazySingletonValue> _SINGLETON_VALUE_CanDowngrade = new LazySingletonValue<>( "canDowngrade", "false", new TypeReference>() {}); private static final LazySingletonValue> _SINGLETON_VALUE_CanConvert = new LazySingletonValue<>( "canConvert", "false", new TypeReference>() {}); } }