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

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

package domains

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

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"
)

// NewGetDomainsParams creates a new GetDomainsParams object
// with the default values initialized.
func NewGetDomainsParams() *GetDomainsParams {
	var ()
	return &GetDomainsParams{

		timeout: cr.DefaultTimeout,
	}
}

// NewGetDomainsParamsWithTimeout creates a new GetDomainsParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetDomainsParamsWithTimeout(timeout time.Duration) *GetDomainsParams {
	var ()
	return &GetDomainsParams{

		timeout: timeout,
	}
}

// NewGetDomainsParamsWithContext creates a new GetDomainsParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetDomainsParamsWithContext(ctx context.Context) *GetDomainsParams {
	var ()
	return &GetDomainsParams{

		Context: ctx,
	}
}

// NewGetDomainsParamsWithHTTPClient creates a new GetDomainsParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetDomainsParamsWithHTTPClient(client *http.Client) *GetDomainsParams {
	var ()
	return &GetDomainsParams{
		HTTPClient: client,
	}
}

/*GetDomainsParams contains all the parameters to send to the API endpoint
for the get domains operation typically these are written to a http.Request
*/
type GetDomainsParams struct {

	/*Active
	  Retrieve only active records?

	*/
	Active *bool
	/*DomainID
	  Taxnexus Id of the Domain to be retrieved

	*/
	DomainID *string
	/*Limit
	  How many objects to return at one time

	*/
	Limit *int64
	/*Name
	  The Tax Domain to rate (cannabis, sales or telecom)

	*/
	Name *string
	/*Offset
	  How many objects to skip? (default 0)

	*/
	Offset *int64

	timeout    time.Duration
	Context    context.Context
	HTTPClient *http.Client
}

// WithTimeout adds the timeout to the get domains params
func (o *GetDomainsParams) WithTimeout(timeout time.Duration) *GetDomainsParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the get domains params
func (o *GetDomainsParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the get domains params
func (o *GetDomainsParams) WithContext(ctx context.Context) *GetDomainsParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the get domains params
func (o *GetDomainsParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

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

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

// WithActive adds the active to the get domains params
func (o *GetDomainsParams) WithActive(active *bool) *GetDomainsParams {
	o.SetActive(active)
	return o
}

// SetActive adds the active to the get domains params
func (o *GetDomainsParams) SetActive(active *bool) {
	o.Active = active
}

// WithDomainID adds the domainID to the get domains params
func (o *GetDomainsParams) WithDomainID(domainID *string) *GetDomainsParams {
	o.SetDomainID(domainID)
	return o
}

// SetDomainID adds the domainId to the get domains params
func (o *GetDomainsParams) SetDomainID(domainID *string) {
	o.DomainID = domainID
}

// WithLimit adds the limit to the get domains params
func (o *GetDomainsParams) WithLimit(limit *int64) *GetDomainsParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the get domains params
func (o *GetDomainsParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithName adds the name to the get domains params
func (o *GetDomainsParams) WithName(name *string) *GetDomainsParams {
	o.SetName(name)
	return o
}

// SetName adds the name to the get domains params
func (o *GetDomainsParams) SetName(name *string) {
	o.Name = name
}

// WithOffset adds the offset to the get domains params
func (o *GetDomainsParams) WithOffset(offset *int64) *GetDomainsParams {
	o.SetOffset(offset)
	return o
}

// SetOffset adds the offset to the get domains params
func (o *GetDomainsParams) SetOffset(offset *int64) {
	o.Offset = offset
}

// WriteToRequest writes these params to a swagger request
func (o *GetDomainsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {

	if err := r.SetTimeout(o.timeout); err != nil {
		return err
	}
	var res []error

	if o.Active != nil {

		// query param active
		var qrActive bool
		if o.Active != nil {
			qrActive = *o.Active
		}
		qActive := swag.FormatBool(qrActive)
		if qActive != "" {
			if err := r.SetQueryParam("active", qActive); err != nil {
				return err
			}
		}

	}

	if o.DomainID != nil {

		// query param domainId
		var qrDomainID string
		if o.DomainID != nil {
			qrDomainID = *o.DomainID
		}
		qDomainID := qrDomainID
		if qDomainID != "" {
			if err := r.SetQueryParam("domainId", qDomainID); err != nil {
				return err
			}
		}

	}

	if o.Limit != nil {

		// query param limit
		var qrLimit int64
		if o.Limit != nil {
			qrLimit = *o.Limit
		}
		qLimit := swag.FormatInt64(qrLimit)
		if qLimit != "" {
			if err := r.SetQueryParam("limit", qLimit); err != nil {
				return err
			}
		}

	}

	if o.Name != nil {

		// query param name
		var qrName string
		if o.Name != nil {
			qrName = *o.Name
		}
		qName := qrName
		if qName != "" {
			if err := r.SetQueryParam("name", qName); err != nil {
				return err
			}
		}

	}

	if o.Offset != nil {

		// query param offset
		var qrOffset int64
		if o.Offset != nil {
			qrOffset = *o.Offset
		}
		qOffset := swag.FormatInt64(qrOffset)
		if qOffset != "" {
			if err := r.SetQueryParam("offset", qOffset); err != nil {
				return err
			}
		}

	}

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