// Code generated by go-swagger; DO NOT EDIT.

package operations

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

// NewGetManifestsParams creates a new GetManifestsParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetManifestsParams() *GetManifestsParams {
	return &GetManifestsParams{
		timeout: cr.DefaultTimeout,
	}
}

// NewGetManifestsParamsWithTimeout creates a new GetManifestsParams object
// with the ability to set a timeout on a request.
func NewGetManifestsParamsWithTimeout(timeout time.Duration) *GetManifestsParams {
	return &GetManifestsParams{
		timeout: timeout,
	}
}

// NewGetManifestsParamsWithContext creates a new GetManifestsParams object
// with the ability to set a context for a request.
func NewGetManifestsParamsWithContext(ctx context.Context) *GetManifestsParams {
	return &GetManifestsParams{
		Context: ctx,
	}
}

// NewGetManifestsParamsWithHTTPClient creates a new GetManifestsParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetManifestsParamsWithHTTPClient(client *http.Client) *GetManifestsParams {
	return &GetManifestsParams{
		HTTPClient: client,
	}
}

/*
GetManifestsParams contains all the parameters to send to the API endpoint

	for the get manifests operation.

	Typically these are written to a http.Request.
*/
type GetManifestsParams struct {

	/* Active.

	   Filter by activate or inactive manifests
	*/
	Active *bool

	/* Desc.

	   Update manifest description
	*/
	Desc *string

	/* ID.

	   Update manifest id
	*/
	ID *string

	/* Limit.

	   Max number of records
	*/
	Limit *int64

	/* ManifestType.

	   Manifest type (1=software, 2=configuration)
	*/
	ManifestType *int64

	/* Name.

	   Update manifest name
	*/
	Name *string

	/* Offset.

	   Records offset
	*/
	Offset *int64

	/* Order.

	   Sort on column with asc or desc
	*/
	Order *string

	/* Search.

	   Text search
	*/
	Search *string

	/* Version.

	   Update manifest version
	*/
	Version *string

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

// WithDefaults hydrates default values in the get manifests params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetManifestsParams) WithDefaults() *GetManifestsParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the get manifests params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetManifestsParams) SetDefaults() {
	// no default values defined for this parameter
}

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

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

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

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

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

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

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

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

// WithDesc adds the desc to the get manifests params
func (o *GetManifestsParams) WithDesc(desc *string) *GetManifestsParams {
	o.SetDesc(desc)
	return o
}

// SetDesc adds the desc to the get manifests params
func (o *GetManifestsParams) SetDesc(desc *string) {
	o.Desc = desc
}

// WithID adds the id to the get manifests params
func (o *GetManifestsParams) WithID(id *string) *GetManifestsParams {
	o.SetID(id)
	return o
}

// SetID adds the id to the get manifests params
func (o *GetManifestsParams) SetID(id *string) {
	o.ID = id
}

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

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

// WithManifestType adds the manifestType to the get manifests params
func (o *GetManifestsParams) WithManifestType(manifestType *int64) *GetManifestsParams {
	o.SetManifestType(manifestType)
	return o
}

// SetManifestType adds the manifestType to the get manifests params
func (o *GetManifestsParams) SetManifestType(manifestType *int64) {
	o.ManifestType = manifestType
}

// WithName adds the name to the get manifests params
func (o *GetManifestsParams) WithName(name *string) *GetManifestsParams {
	o.SetName(name)
	return o
}

// SetName adds the name to the get manifests params
func (o *GetManifestsParams) SetName(name *string) {
	o.Name = name
}

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

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

// WithOrder adds the order to the get manifests params
func (o *GetManifestsParams) WithOrder(order *string) *GetManifestsParams {
	o.SetOrder(order)
	return o
}

// SetOrder adds the order to the get manifests params
func (o *GetManifestsParams) SetOrder(order *string) {
	o.Order = order
}

// WithSearch adds the search to the get manifests params
func (o *GetManifestsParams) WithSearch(search *string) *GetManifestsParams {
	o.SetSearch(search)
	return o
}

// SetSearch adds the search to the get manifests params
func (o *GetManifestsParams) SetSearch(search *string) {
	o.Search = search
}

// WithVersion adds the version to the get manifests params
func (o *GetManifestsParams) WithVersion(version *string) *GetManifestsParams {
	o.SetVersion(version)
	return o
}

// SetVersion adds the version to the get manifests params
func (o *GetManifestsParams) SetVersion(version *string) {
	o.Version = version
}

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

		// query param desc
		var qrDesc string

		if o.Desc != nil {
			qrDesc = *o.Desc
		}
		qDesc := qrDesc
		if qDesc != "" {

			if err := r.SetQueryParam("desc", qDesc); err != nil {
				return err
			}
		}
	}

	if o.ID != nil {

		// query param id
		var qrID string

		if o.ID != nil {
			qrID = *o.ID
		}
		qID := qrID
		if qID != "" {

			if err := r.SetQueryParam("id", qID); 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.ManifestType != nil {

		// query param manifest_type
		var qrManifestType int64

		if o.ManifestType != nil {
			qrManifestType = *o.ManifestType
		}
		qManifestType := swag.FormatInt64(qrManifestType)
		if qManifestType != "" {

			if err := r.SetQueryParam("manifest_type", qManifestType); err != nil {
				return err
			}
		}
	}

	if o.Name != nil {

		// query param name
		var qrName string

		if o.Name != nil {
			qrName = *o.Name
		}
		qName := qrName
		if qName != "" {

			if err := r.SetQueryParam("name", qName); 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.Order != nil {

		// query param order
		var qrOrder string

		if o.Order != nil {
			qrOrder = *o.Order
		}
		qOrder := qrOrder
		if qOrder != "" {

			if err := r.SetQueryParam("order", qOrder); err != nil {
				return err
			}
		}
	}

	if o.Search != nil {

		// query param search
		var qrSearch string

		if o.Search != nil {
			qrSearch = *o.Search
		}
		qSearch := qrSearch
		if qSearch != "" {

			if err := r.SetQueryParam("search", qSearch); err != nil {
				return err
			}
		}
	}

	if o.Version != nil {

		// query param version
		var qrVersion string

		if o.Version != nil {
			qrVersion = *o.Version
		}
		qVersion := qrVersion
		if qVersion != "" {

			if err := r.SetQueryParam("version", qVersion); err != nil {
				return err
			}
		}
	}

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