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

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

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

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

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

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

	for the get cansignals vin operation.

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

	/* AfterTimestamp.

	   Time from which we want to see the can signals from
	*/
	AfterTimestamp *string

	/* AfterUtc.

	   Time from which we want to see the can signals from
	*/
	AfterUtc *int64

	/* Limit.

	   Max number of records. Default is 20 if not set
	*/
	Limit *int64

	/* Vin.

	   VIN
	*/
	Vin string

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

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

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

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

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

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

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

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

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

// WithAfterTimestamp adds the afterTimestamp to the get cansignals vin params
func (o *GetCansignalsVinParams) WithAfterTimestamp(afterTimestamp *string) *GetCansignalsVinParams {
	o.SetAfterTimestamp(afterTimestamp)
	return o
}

// SetAfterTimestamp adds the afterTimestamp to the get cansignals vin params
func (o *GetCansignalsVinParams) SetAfterTimestamp(afterTimestamp *string) {
	o.AfterTimestamp = afterTimestamp
}

// WithAfterUtc adds the afterUtc to the get cansignals vin params
func (o *GetCansignalsVinParams) WithAfterUtc(afterUtc *int64) *GetCansignalsVinParams {
	o.SetAfterUtc(afterUtc)
	return o
}

// SetAfterUtc adds the afterUtc to the get cansignals vin params
func (o *GetCansignalsVinParams) SetAfterUtc(afterUtc *int64) {
	o.AfterUtc = afterUtc
}

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

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

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

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

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

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

	if o.AfterTimestamp != nil {

		// query param after_timestamp
		var qrAfterTimestamp string

		if o.AfterTimestamp != nil {
			qrAfterTimestamp = *o.AfterTimestamp
		}
		qAfterTimestamp := qrAfterTimestamp
		if qAfterTimestamp != "" {

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

	if o.AfterUtc != nil {

		// query param after_utc
		var qrAfterUtc int64

		if o.AfterUtc != nil {
			qrAfterUtc = *o.AfterUtc
		}
		qAfterUtc := swag.FormatInt64(qrAfterUtc)
		if qAfterUtc != "" {

			if err := r.SetQueryParam("after_utc", qAfterUtc); 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
			}
		}
	}

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

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