/* 
 * 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 dev.plexapi.sdk.utils.SpeakeasyMetadata;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Long;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;


public class GetBandwidthStatisticsRequest {

    /**
     * The timespan to retrieve statistics for
     * the exact meaning of this parameter is not known
     * 
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=Timespan")
    private Optional<Long> timespan;

    @JsonCreator
    public GetBandwidthStatisticsRequest(
            Optional<Long> timespan) {
        Utils.checkNotNull(timespan, "timespan");
        this.timespan = timespan;
    }
    
    public GetBandwidthStatisticsRequest() {
        this(Optional.empty());
    }

    /**
     * The timespan to retrieve statistics for
     * the exact meaning of this parameter is not known
     * 
     */
    @JsonIgnore
    public Optional<Long> timespan() {
        return timespan;
    }

    public final static Builder builder() {
        return new Builder();
    }

    /**
     * The timespan to retrieve statistics for
     * the exact meaning of this parameter is not known
     * 
     */
    public GetBandwidthStatisticsRequest withTimespan(long timespan) {
        Utils.checkNotNull(timespan, "timespan");
        this.timespan = Optional.ofNullable(timespan);
        return this;
    }

    /**
     * The timespan to retrieve statistics for
     * the exact meaning of this parameter is not known
     * 
     */
    public GetBandwidthStatisticsRequest withTimespan(Optional<Long> timespan) {
        Utils.checkNotNull(timespan, "timespan");
        this.timespan = timespan;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GetBandwidthStatisticsRequest other = (GetBandwidthStatisticsRequest) o;
        return 
            Objects.deepEquals(this.timespan, other.timespan);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            timespan);
    }
    
    @Override
    public String toString() {
        return Utils.toString(GetBandwidthStatisticsRequest.class,
                "timespan", timespan);
    }
    
    public final static class Builder {
 
        private Optional<Long> timespan = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

        /**
         * The timespan to retrieve statistics for
         * the exact meaning of this parameter is not known
         * 
         */
        public Builder timespan(long timespan) {
            Utils.checkNotNull(timespan, "timespan");
            this.timespan = Optional.ofNullable(timespan);
            return this;
        }

        /**
         * The timespan to retrieve statistics for
         * the exact meaning of this parameter is not known
         * 
         */
        public Builder timespan(Optional<Long> timespan) {
            Utils.checkNotNull(timespan, "timespan");
            this.timespan = timespan;
            return this;
        }
        
        public GetBandwidthStatisticsRequest build() {
            return new GetBandwidthStatisticsRequest(
                timespan);
        }
    }
}

