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

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

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

		timeout: cr.DefaultTimeout,
	}
}

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

		timeout: timeout,
	}
}

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

		Context: ctx,
	}
}

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

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

	/*Limit
	  How many objects to return at one time

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

	*/
	Offset *int64
	/*PurchaseOrderID
	  Taxnexus Record Id of a Company

	*/
	PurchaseOrderID *string

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

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

// SetTimeout adds the timeout to the get purchase orders params
func (o *GetPurchaseOrdersParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

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

// SetContext adds the context to the get purchase orders params
func (o *GetPurchaseOrdersParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

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

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

// WithLimit adds the limit to the get purchase orders params
func (o *GetPurchaseOrdersParams) WithLimit(limit *int64) *GetPurchaseOrdersParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the get purchase orders params
func (o *GetPurchaseOrdersParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithOffset adds the offset to the get purchase orders params
func (o *GetPurchaseOrdersParams) WithOffset(offset *int64) *GetPurchaseOrdersParams {
	o.SetOffset(offset)
	return o
}

// SetOffset adds the offset to the get purchase orders params
func (o *GetPurchaseOrdersParams) SetOffset(offset *int64) {
	o.Offset = offset
}

// WithPurchaseOrderID adds the purchaseOrderID to the get purchase orders params
func (o *GetPurchaseOrdersParams) WithPurchaseOrderID(purchaseOrderID *string) *GetPurchaseOrdersParams {
	o.SetPurchaseOrderID(purchaseOrderID)
	return o
}

// SetPurchaseOrderID adds the purchaseOrderId to the get purchase orders params
func (o *GetPurchaseOrdersParams) SetPurchaseOrderID(purchaseOrderID *string) {
	o.PurchaseOrderID = purchaseOrderID
}

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

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

	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.PurchaseOrderID != nil {

		// query param purchaseOrderId
		var qrPurchaseOrderID string
		if o.PurchaseOrderID != nil {
			qrPurchaseOrderID = *o.PurchaseOrderID
		}
		qPurchaseOrderID := qrPurchaseOrderID
		if qPurchaseOrderID != "" {
			if err := r.SetQueryParam("purchaseOrderId", qPurchaseOrderID); err != nil {
				return err
			}
		}

	}

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