// Code generated by go-swagger; DO NOT EDIT.

// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package portal_clients

import (
	"context"
	"net/http"
	"time"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/runtime"
	cr "github.com/go-openapi/runtime/client"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag/conv"
)

// NewGetAuthorizedClientScopesParams creates a new GetAuthorizedClientScopesParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAuthorizedClientScopesParams() *GetAuthorizedClientScopesParams {
	return NewGetAuthorizedClientScopesParamsWithTimeout(cr.DefaultTimeout)
}

// NewGetAuthorizedClientScopesParamsWithTimeout creates a new GetAuthorizedClientScopesParams object
// with the ability to set a timeout on a request.
func NewGetAuthorizedClientScopesParamsWithTimeout(timeout time.Duration) *GetAuthorizedClientScopesParams {
	return &GetAuthorizedClientScopesParams{
		inner: innerParams{
			timeout: timeout,
		},
	}
}

// NewGetAuthorizedClientScopesParamsWithContext creates a new GetAuthorizedClientScopesParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAuthorizedClientScopesParams].
func NewGetAuthorizedClientScopesParamsWithContext(ctx context.Context) *GetAuthorizedClientScopesParams {
	return &GetAuthorizedClientScopesParams{
		inner: innerParams{
			ctx: ctx,
		},
	}
}

// NewGetAuthorizedClientScopesParamsWithHTTPClient creates a new GetAuthorizedClientScopesParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAuthorizedClientScopesParamsWithHTTPClient(client *http.Client) *GetAuthorizedClientScopesParams {
	return &GetAuthorizedClientScopesParams{
		HTTPClient: client,
	}
}

/*
GetAuthorizedClientScopesParams contains all the parameters to send to the API endpoint

	for the get authorized client scopes operation.

	Typically these are written to a http.Request.
*/
type GetAuthorizedClientScopesParams struct {

	// AuthorizedClientID.
	//
	// Format: uuid
	AuthorizedClientID *strfmt.UUID

	// ID.
	//
	// Format: uuid
	ID *strfmt.UUID

	// Limit.
	//
	// Format: int64
	// Default: 100
	Limit *int64

	// Offset.
	//
	// Format: int64
	Offset *int64

	// Scope.
	Scope *string

	// ServiceID.
	//
	// Format: uuid
	ServiceID *strfmt.UUID

	HTTPClient *http.Client

	inner innerParams
}

// WithDefaults hydrates default values in the get authorized client scopes params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAuthorizedClientScopesParams) WithDefaults() *GetAuthorizedClientScopesParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the get authorized client scopes params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAuthorizedClientScopesParams) SetDefaults() {
	var (
		limitDefault = int64(100)

		offsetDefault = int64(0)
	)

	val := GetAuthorizedClientScopesParams{
		Limit:  &limitDefault,
		Offset: &offsetDefault,
	}

	val.inner.timeout = o.inner.timeout
	val.inner.ctx = o.inner.ctx
	val.HTTPClient = o.HTTPClient
	*o = val
}

// WithTimeout adds the timeout to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) WithTimeout(timeout time.Duration) *GetAuthorizedClientScopesParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) SetTimeout(timeout time.Duration) {
	o.inner.timeout = timeout
}

// WithContext adds the context to the get authorized client scopes params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAuthorizedClientScopesParams].
func (o *GetAuthorizedClientScopesParams) WithContext(ctx context.Context) *GetAuthorizedClientScopesParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the get authorized client scopes params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetAuthorizedClientScopesParams].
func (o *GetAuthorizedClientScopesParams) SetContext(ctx context.Context) {
	o.inner.ctx = ctx
}

// WithHTTPClient adds the HTTPClient to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) WithHTTPClient(client *http.Client) *GetAuthorizedClientScopesParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithAuthorizedClientID adds the authorizedClientID to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) WithAuthorizedClientID(authorizedClientID *strfmt.UUID) *GetAuthorizedClientScopesParams {
	o.SetAuthorizedClientID(authorizedClientID)
	return o
}

// SetAuthorizedClientID adds the authorizedClientId to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) SetAuthorizedClientID(authorizedClientID *strfmt.UUID) {
	o.AuthorizedClientID = authorizedClientID
}

// WithID adds the id to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) WithID(id *strfmt.UUID) *GetAuthorizedClientScopesParams {
	o.SetID(id)
	return o
}

// SetID adds the id to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) SetID(id *strfmt.UUID) {
	o.ID = id
}

// WithLimit adds the limit to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) WithLimit(limit *int64) *GetAuthorizedClientScopesParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithOffset adds the offset to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) WithOffset(offset *int64) *GetAuthorizedClientScopesParams {
	o.SetOffset(offset)
	return o
}

// SetOffset adds the offset to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) SetOffset(offset *int64) {
	o.Offset = offset
}

// WithScope adds the scope to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) WithScope(scope *string) *GetAuthorizedClientScopesParams {
	o.SetScope(scope)
	return o
}

// SetScope adds the scope to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) SetScope(scope *string) {
	o.Scope = scope
}

// WithServiceID adds the serviceID to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) WithServiceID(serviceID *strfmt.UUID) *GetAuthorizedClientScopesParams {
	o.SetServiceID(serviceID)
	return o
}

// SetServiceID adds the serviceId to the get authorized client scopes params.
func (o *GetAuthorizedClientScopesParams) SetServiceID(serviceID *strfmt.UUID) {
	o.ServiceID = serviceID
}

// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetAuthorizedClientScopesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
	if err := r.SetTimeout(o.inner.timeout); err != nil {
		return err
	}
	var res []error

	if o.AuthorizedClientID != nil {

		// query param authorizedClientId
		var qrAuthorizedClientID strfmt.UUID

		if o.AuthorizedClientID != nil {
			qrAuthorizedClientID = *o.AuthorizedClientID
		}
		qAuthorizedClientID := qrAuthorizedClientID.String()
		if qAuthorizedClientID != "" {

			if err := r.SetQueryParam("authorizedClientId", qAuthorizedClientID); err != nil {
				return err
			}
		}
	}

	if o.ID != nil {

		// query param id
		var qrID strfmt.UUID

		if o.ID != nil {
			qrID = *o.ID
		}
		qID := qrID.String()
		if qID != "" {

			if err := r.SetQueryParam("id", qID); err != nil {
				return err
			}
		}
	}

	if o.Limit != nil {

		// query param limit
		var qrLimit int64

		if o.Limit != nil {
			qrLimit = *o.Limit
		}
		qLimit := conv.FormatInteger(qrLimit)
		if qLimit != "" {

			if err := r.SetQueryParam("limit", qLimit); err != nil {
				return err
			}
		}
	}

	if o.Offset != nil {

		// query param offset
		var qrOffset int64

		if o.Offset != nil {
			qrOffset = *o.Offset
		}
		qOffset := conv.FormatInteger(qrOffset)
		if qOffset != "" {

			if err := r.SetQueryParam("offset", qOffset); err != nil {
				return err
			}
		}
	}

	if o.Scope != nil {

		// query param scope
		var qrScope string

		if o.Scope != nil {
			qrScope = *o.Scope
		}
		qScope := qrScope
		if qScope != "" {

			if err := r.SetQueryParam("scope", qScope); err != nil {
				return err
			}
		}
	}

	if o.ServiceID != nil {

		// query param serviceId
		var qrServiceID strfmt.UUID

		if o.ServiceID != nil {
			qrServiceID = *o.ServiceID
		}
		qServiceID := qrServiceID.String()
		if qServiceID != "" {

			if err := r.SetQueryParam("serviceId", qServiceID); err != nil {
				return err
			}
		}
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
