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

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

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

		timeout: cr.DefaultTimeout,
	}
}

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

		timeout: timeout,
	}
}

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

		Context: ctx,
	}
}

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

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

	/*Production
	  Use Production API?

	*/
	Production *bool
	/*Reseller
	  The METRC Reseller Key

	*/
	Reseller string
	/*State
	  The 2-character State Code

	*/
	State string
	/*User
	  The METRC User Key

	*/
	User string

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

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

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

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

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

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

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

// WithProduction adds the production to the get facilities params
func (o *GetFacilitiesParams) WithProduction(production *bool) *GetFacilitiesParams {
	o.SetProduction(production)
	return o
}

// SetProduction adds the production to the get facilities params
func (o *GetFacilitiesParams) SetProduction(production *bool) {
	o.Production = production
}

// WithReseller adds the reseller to the get facilities params
func (o *GetFacilitiesParams) WithReseller(reseller string) *GetFacilitiesParams {
	o.SetReseller(reseller)
	return o
}

// SetReseller adds the reseller to the get facilities params
func (o *GetFacilitiesParams) SetReseller(reseller string) {
	o.Reseller = reseller
}

// WithState adds the state to the get facilities params
func (o *GetFacilitiesParams) WithState(state string) *GetFacilitiesParams {
	o.SetState(state)
	return o
}

// SetState adds the state to the get facilities params
func (o *GetFacilitiesParams) SetState(state string) {
	o.State = state
}

// WithUser adds the user to the get facilities params
func (o *GetFacilitiesParams) WithUser(user string) *GetFacilitiesParams {
	o.SetUser(user)
	return o
}

// SetUser adds the user to the get facilities params
func (o *GetFacilitiesParams) SetUser(user string) {
	o.User = user
}

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

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

	if o.Production != nil {

		// query param production
		var qrProduction bool
		if o.Production != nil {
			qrProduction = *o.Production
		}
		qProduction := swag.FormatBool(qrProduction)
		if qProduction != "" {
			if err := r.SetQueryParam("production", qProduction); err != nil {
				return err
			}
		}

	}

	// query param reseller
	qrReseller := o.Reseller
	qReseller := qrReseller
	if qReseller != "" {
		if err := r.SetQueryParam("reseller", qReseller); err != nil {
			return err
		}
	}

	// query param state
	qrState := o.State
	qState := qrState
	if qState != "" {
		if err := r.SetQueryParam("state", qState); err != nil {
			return err
		}
	}

	// query param user
	qrUser := o.User
	qUser := qrUser
	if qUser != "" {
		if err := r.SetQueryParam("user", qUser); err != nil {
			return err
		}
	}

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