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

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

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

		timeout: cr.DefaultTimeout,
	}
}

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

		timeout: timeout,
	}
}

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

		Context: ctx,
	}
}

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

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

	/*LastModifiedEnd
	  The last modified end timestamp

	*/
	LastModifiedEnd *string
	/*LastModifiedStart
	  The last modified start timestamp

	*/
	LastModifiedStart *string
	/*License
	  The Licnese Number for the query

	*/
	License string
	/*Production
	  Use Production API?

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

	*/
	Reseller string
	/*SalesReceiptID
	  The Sales Receipt Number

	*/
	SalesReceiptID *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 sales receipts params
func (o *GetSalesReceiptsParams) WithTimeout(timeout time.Duration) *GetSalesReceiptsParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the get sales receipts params
func (o *GetSalesReceiptsParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

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

// SetContext adds the context to the get sales receipts params
func (o *GetSalesReceiptsParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

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

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

// WithLastModifiedEnd adds the lastModifiedEnd to the get sales receipts params
func (o *GetSalesReceiptsParams) WithLastModifiedEnd(lastModifiedEnd *string) *GetSalesReceiptsParams {
	o.SetLastModifiedEnd(lastModifiedEnd)
	return o
}

// SetLastModifiedEnd adds the lastModifiedEnd to the get sales receipts params
func (o *GetSalesReceiptsParams) SetLastModifiedEnd(lastModifiedEnd *string) {
	o.LastModifiedEnd = lastModifiedEnd
}

// WithLastModifiedStart adds the lastModifiedStart to the get sales receipts params
func (o *GetSalesReceiptsParams) WithLastModifiedStart(lastModifiedStart *string) *GetSalesReceiptsParams {
	o.SetLastModifiedStart(lastModifiedStart)
	return o
}

// SetLastModifiedStart adds the lastModifiedStart to the get sales receipts params
func (o *GetSalesReceiptsParams) SetLastModifiedStart(lastModifiedStart *string) {
	o.LastModifiedStart = lastModifiedStart
}

// WithLicense adds the license to the get sales receipts params
func (o *GetSalesReceiptsParams) WithLicense(license string) *GetSalesReceiptsParams {
	o.SetLicense(license)
	return o
}

// SetLicense adds the license to the get sales receipts params
func (o *GetSalesReceiptsParams) SetLicense(license string) {
	o.License = license
}

// WithProduction adds the production to the get sales receipts params
func (o *GetSalesReceiptsParams) WithProduction(production *bool) *GetSalesReceiptsParams {
	o.SetProduction(production)
	return o
}

// SetProduction adds the production to the get sales receipts params
func (o *GetSalesReceiptsParams) SetProduction(production *bool) {
	o.Production = production
}

// WithReseller adds the reseller to the get sales receipts params
func (o *GetSalesReceiptsParams) WithReseller(reseller string) *GetSalesReceiptsParams {
	o.SetReseller(reseller)
	return o
}

// SetReseller adds the reseller to the get sales receipts params
func (o *GetSalesReceiptsParams) SetReseller(reseller string) {
	o.Reseller = reseller
}

// WithSalesReceiptID adds the salesReceiptID to the get sales receipts params
func (o *GetSalesReceiptsParams) WithSalesReceiptID(salesReceiptID *string) *GetSalesReceiptsParams {
	o.SetSalesReceiptID(salesReceiptID)
	return o
}

// SetSalesReceiptID adds the salesReceiptId to the get sales receipts params
func (o *GetSalesReceiptsParams) SetSalesReceiptID(salesReceiptID *string) {
	o.SalesReceiptID = salesReceiptID
}

// WithState adds the state to the get sales receipts params
func (o *GetSalesReceiptsParams) WithState(state string) *GetSalesReceiptsParams {
	o.SetState(state)
	return o
}

// SetState adds the state to the get sales receipts params
func (o *GetSalesReceiptsParams) SetState(state string) {
	o.State = state
}

// WithUser adds the user to the get sales receipts params
func (o *GetSalesReceiptsParams) WithUser(user string) *GetSalesReceiptsParams {
	o.SetUser(user)
	return o
}

// SetUser adds the user to the get sales receipts params
func (o *GetSalesReceiptsParams) SetUser(user string) {
	o.User = user
}

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

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

	if o.LastModifiedEnd != nil {

		// query param lastModifiedEnd
		var qrLastModifiedEnd string
		if o.LastModifiedEnd != nil {
			qrLastModifiedEnd = *o.LastModifiedEnd
		}
		qLastModifiedEnd := qrLastModifiedEnd
		if qLastModifiedEnd != "" {
			if err := r.SetQueryParam("lastModifiedEnd", qLastModifiedEnd); err != nil {
				return err
			}
		}

	}

	if o.LastModifiedStart != nil {

		// query param lastModifiedStart
		var qrLastModifiedStart string
		if o.LastModifiedStart != nil {
			qrLastModifiedStart = *o.LastModifiedStart
		}
		qLastModifiedStart := qrLastModifiedStart
		if qLastModifiedStart != "" {
			if err := r.SetQueryParam("lastModifiedStart", qLastModifiedStart); err != nil {
				return err
			}
		}

	}

	// query param license
	qrLicense := o.License
	qLicense := qrLicense
	if qLicense != "" {
		if err := r.SetQueryParam("license", qLicense); err != nil {
			return err
		}
	}

	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
		}
	}

	if o.SalesReceiptID != nil {

		// query param salesReceiptId
		var qrSalesReceiptID string
		if o.SalesReceiptID != nil {
			qrSalesReceiptID = *o.SalesReceiptID
		}
		qSalesReceiptID := qrSalesReceiptID
		if qSalesReceiptID != "" {
			if err := r.SetQueryParam("salesReceiptId", qSalesReceiptID); 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
}
