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

// NewGetCarupdatesParams creates a new GetCarupdatesParams 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 NewGetCarupdatesParams() *GetCarupdatesParams {
	return &GetCarupdatesParams{
		timeout: cr.DefaultTimeout,
	}
}

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

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

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

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

	for the get carupdates operation.

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

	/* ID.

	   CarUpdate id
	*/
	ID *int64

	/* Limit.

	   Max number of records
	*/
	Limit *int64

	/* ManifestID.

	   Update manifest id
	*/
	ManifestID *int64

	/* Offset.

	   Records offset
	*/
	Offset *int64

	/* Order.

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

	/* Vin.

	   Car VIN
	*/
	Vin *string

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

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

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

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

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

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

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

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

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

// WithID adds the id to the get carupdates params
func (o *GetCarupdatesParams) WithID(id *int64) *GetCarupdatesParams {
	o.SetID(id)
	return o
}

// SetID adds the id to the get carupdates params
func (o *GetCarupdatesParams) SetID(id *int64) {
	o.ID = id
}

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

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

// WithManifestID adds the manifestID to the get carupdates params
func (o *GetCarupdatesParams) WithManifestID(manifestID *int64) *GetCarupdatesParams {
	o.SetManifestID(manifestID)
	return o
}

// SetManifestID adds the manifestId to the get carupdates params
func (o *GetCarupdatesParams) SetManifestID(manifestID *int64) {
	o.ManifestID = manifestID
}

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

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

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

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

// WithVin adds the vin to the get carupdates params
func (o *GetCarupdatesParams) WithVin(vin *string) *GetCarupdatesParams {
	o.SetVin(vin)
	return o
}

// SetVin adds the vin to the get carupdates params
func (o *GetCarupdatesParams) SetVin(vin *string) {
	o.Vin = vin
}

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

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

	if o.ID != nil {

		// query param id
		var qrID int64

		if o.ID != nil {
			qrID = *o.ID
		}
		qID := swag.FormatInt64(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.ManifestID != nil {

		// query param manifest_id
		var qrManifestID int64

		if o.ManifestID != nil {
			qrManifestID = *o.ManifestID
		}
		qManifestID := swag.FormatInt64(qrManifestID)
		if qManifestID != "" {

			if err := r.SetQueryParam("manifest_id", qManifestID); 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.Vin != nil {

		// query param vin
		var qrVin string

		if o.Vin != nil {
			qrVin = *o.Vin
		}
		qVin := qrVin
		if qVin != "" {

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

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