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

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

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

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

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

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

	for the get vehicleecus operation.

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

	/* Limit.

	   Max number of records
	*/
	Limit *int64

	/* Offset.

	   Records offset
	*/
	Offset *int64

	/* Order.

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

	/* Search.

	   Text search
	*/
	Search *string

	/* Unique.

	   Get only latest ECU versions
	*/
	Unique *bool

	/* Vin.

	   Car VIN
	*/
	Vin string

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// WithUnique adds the unique to the get vehicleecus params
func (o *GetVehicleecusParams) WithUnique(unique *bool) *GetVehicleecusParams {
	o.SetUnique(unique)
	return o
}

// SetUnique adds the unique to the get vehicleecus params
func (o *GetVehicleecusParams) SetUnique(unique *bool) {
	o.Unique = unique
}

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

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

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

		// query param unique
		var qrUnique bool

		if o.Unique != nil {
			qrUnique = *o.Unique
		}
		qUnique := swag.FormatBool(qrUnique)
		if qUnique != "" {

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

	// query param vin
	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
}
