// 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 product

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

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

		timeout: cr.DefaultTimeout,
	}
}

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

		timeout: timeout,
	}
}

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

		Context: ctx,
	}
}

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

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

	/*Active
	  Retrieve active records?

	*/
	Active *bool
	/*Limit
	  How many objects to return at one time

	*/
	Limit *int64
	/*Offset
	  How many objects to skip? (default 0)

	*/
	Offset *int64
	/*ProductCode
	  Product Code of a Product

	*/
	ProductCode *string
	/*ProductID
	  Taxnexus Record Id of a Product

	*/
	ProductID *string
	/*Publish
	  Is this product published?

	*/
	Publish *bool

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

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

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

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

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

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

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

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

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

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

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

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

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

// WithProductCode adds the productCode to the get products params
func (o *GetProductsParams) WithProductCode(productCode *string) *GetProductsParams {
	o.SetProductCode(productCode)
	return o
}

// SetProductCode adds the productCode to the get products params
func (o *GetProductsParams) SetProductCode(productCode *string) {
	o.ProductCode = productCode
}

// WithProductID adds the productID to the get products params
func (o *GetProductsParams) WithProductID(productID *string) *GetProductsParams {
	o.SetProductID(productID)
	return o
}

// SetProductID adds the productId to the get products params
func (o *GetProductsParams) SetProductID(productID *string) {
	o.ProductID = productID
}

// WithPublish adds the publish to the get products params
func (o *GetProductsParams) WithPublish(publish *bool) *GetProductsParams {
	o.SetPublish(publish)
	return o
}

// SetPublish adds the publish to the get products params
func (o *GetProductsParams) SetPublish(publish *bool) {
	o.Publish = publish
}

// WriteToRequest writes these params to a swagger request
func (o *GetProductsParams) 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.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.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 o.ProductCode != nil {

		// query param productCode
		var qrProductCode string
		if o.ProductCode != nil {
			qrProductCode = *o.ProductCode
		}
		qProductCode := qrProductCode
		if qProductCode != "" {
			if err := r.SetQueryParam("productCode", qProductCode); err != nil {
				return err
			}
		}

	}

	if o.ProductID != nil {

		// query param productId
		var qrProductID string
		if o.ProductID != nil {
			qrProductID = *o.ProductID
		}
		qProductID := qrProductID
		if qProductID != "" {
			if err := r.SetQueryParam("productId", qProductID); err != nil {
				return err
			}
		}

	}

	if o.Publish != nil {

		// query param publish
		var qrPublish bool
		if o.Publish != nil {
			qrPublish = *o.Publish
		}
		qPublish := swag.FormatBool(qrPublish)
		if qPublish != "" {
			if err := r.SetQueryParam("publish", qPublish); err != nil {
				return err
			}
		}

	}

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