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

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

		timeout: cr.DefaultTimeout,
	}
}

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

		timeout: timeout,
	}
}

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

		Context: ctx,
	}
}

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

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

	/*Active
	  Retrieve active records?

	*/
	Active *bool
	/*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 observable params
func (o *GetProductsObservableParams) WithTimeout(timeout time.Duration) *GetProductsObservableParams {
	o.SetTimeout(timeout)
	return o
}

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

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

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

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

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

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

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

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

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

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

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

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

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

// WriteToRequest writes these params to a swagger request
func (o *GetProductsObservableParams) 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.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
}
