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

package e_c_u

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

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

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

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

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

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

	for the get dtcs vin operation.

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

	/* Decode.

	   Return decoded dtc information
	*/
	Decode *bool

	/* Ecu.

	   ECU
	*/
	Ecu *string

	/* EndTime.

	   End time (RFC3339 format)
	*/
	EndTime *string

	/* Limit.

	   Max number of records
	*/
	Limit *int64

	/* Offset.

	   Records offset
	*/
	Offset *int64

	/* Order.

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

	/* StartTime.

	   Start time (RFC3339 format)
	*/
	StartTime *string

	/* TroubleCode.

	   Trouble Code
	*/
	TroubleCode *string

	/* Vin.

	   VIN
	*/
	Vin string

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

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

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

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

// SetTimeout adds the timeout to the get dtcs vin params
func (o *GetDtcsVinParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

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

// SetContext adds the context to the get dtcs vin params
func (o *GetDtcsVinParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

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

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

// WithDecode adds the decode to the get dtcs vin params
func (o *GetDtcsVinParams) WithDecode(decode *bool) *GetDtcsVinParams {
	o.SetDecode(decode)
	return o
}

// SetDecode adds the decode to the get dtcs vin params
func (o *GetDtcsVinParams) SetDecode(decode *bool) {
	o.Decode = decode
}

// WithEcu adds the ecu to the get dtcs vin params
func (o *GetDtcsVinParams) WithEcu(ecu *string) *GetDtcsVinParams {
	o.SetEcu(ecu)
	return o
}

// SetEcu adds the ecu to the get dtcs vin params
func (o *GetDtcsVinParams) SetEcu(ecu *string) {
	o.Ecu = ecu
}

// WithEndTime adds the endTime to the get dtcs vin params
func (o *GetDtcsVinParams) WithEndTime(endTime *string) *GetDtcsVinParams {
	o.SetEndTime(endTime)
	return o
}

// SetEndTime adds the endTime to the get dtcs vin params
func (o *GetDtcsVinParams) SetEndTime(endTime *string) {
	o.EndTime = endTime
}

// WithLimit adds the limit to the get dtcs vin params
func (o *GetDtcsVinParams) WithLimit(limit *int64) *GetDtcsVinParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the get dtcs vin params
func (o *GetDtcsVinParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithOffset adds the offset to the get dtcs vin params
func (o *GetDtcsVinParams) WithOffset(offset *int64) *GetDtcsVinParams {
	o.SetOffset(offset)
	return o
}

// SetOffset adds the offset to the get dtcs vin params
func (o *GetDtcsVinParams) SetOffset(offset *int64) {
	o.Offset = offset
}

// WithOrder adds the order to the get dtcs vin params
func (o *GetDtcsVinParams) WithOrder(order *string) *GetDtcsVinParams {
	o.SetOrder(order)
	return o
}

// SetOrder adds the order to the get dtcs vin params
func (o *GetDtcsVinParams) SetOrder(order *string) {
	o.Order = order
}

// WithStartTime adds the startTime to the get dtcs vin params
func (o *GetDtcsVinParams) WithStartTime(startTime *string) *GetDtcsVinParams {
	o.SetStartTime(startTime)
	return o
}

// SetStartTime adds the startTime to the get dtcs vin params
func (o *GetDtcsVinParams) SetStartTime(startTime *string) {
	o.StartTime = startTime
}

// WithTroubleCode adds the troubleCode to the get dtcs vin params
func (o *GetDtcsVinParams) WithTroubleCode(troubleCode *string) *GetDtcsVinParams {
	o.SetTroubleCode(troubleCode)
	return o
}

// SetTroubleCode adds the troubleCode to the get dtcs vin params
func (o *GetDtcsVinParams) SetTroubleCode(troubleCode *string) {
	o.TroubleCode = troubleCode
}

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

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

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

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

	if o.Decode != nil {

		// query param decode
		var qrDecode bool

		if o.Decode != nil {
			qrDecode = *o.Decode
		}
		qDecode := swag.FormatBool(qrDecode)
		if qDecode != "" {

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

	if o.Ecu != nil {

		// query param ecu
		var qrEcu string

		if o.Ecu != nil {
			qrEcu = *o.Ecu
		}
		qEcu := qrEcu
		if qEcu != "" {

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

	if o.EndTime != nil {

		// query param end_time
		var qrEndTime string

		if o.EndTime != nil {
			qrEndTime = *o.EndTime
		}
		qEndTime := qrEndTime
		if qEndTime != "" {

			if err := r.SetQueryParam("end_time", qEndTime); 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.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.StartTime != nil {

		// query param start_time
		var qrStartTime string

		if o.StartTime != nil {
			qrStartTime = *o.StartTime
		}
		qStartTime := qrStartTime
		if qStartTime != "" {

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

	if o.TroubleCode != nil {

		// query param trouble_code
		var qrTroubleCode string

		if o.TroubleCode != nil {
			qrTroubleCode = *o.TroubleCode
		}
		qTroubleCode := qrTroubleCode
		if qTroubleCode != "" {

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

	// path param vin
	if err := r.SetPathParam("vin", o.Vin); err != nil {
		return err
	}

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