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

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

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

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

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

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

	for the get can signals export operation.

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

	/* CanSignals.

	   CAN Signals
	*/
	CanSignals []string

	/* SelectAll.

	   Select All CAN Signals
	*/
	SelectAll *bool

	/* TimestampEnd.

	   End time must be included
	*/
	TimestampEnd float64

	/* TimestampStart.

	   Start time must be included
	*/
	TimestampStart float64

	/* Vin.

	   VIN must be included in the query
	*/
	Vin string

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

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

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

// WithTimeout adds the timeout to the get can signals export params
func (o *GetCanSignalsExportParams) WithTimeout(timeout time.Duration) *GetCanSignalsExportParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the get can signals export params
func (o *GetCanSignalsExportParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the get can signals export params
func (o *GetCanSignalsExportParams) WithContext(ctx context.Context) *GetCanSignalsExportParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the get can signals export params
func (o *GetCanSignalsExportParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the get can signals export params
func (o *GetCanSignalsExportParams) WithHTTPClient(client *http.Client) *GetCanSignalsExportParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the get can signals export params
func (o *GetCanSignalsExportParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithCanSignals adds the canSignals to the get can signals export params
func (o *GetCanSignalsExportParams) WithCanSignals(canSignals []string) *GetCanSignalsExportParams {
	o.SetCanSignals(canSignals)
	return o
}

// SetCanSignals adds the canSignals to the get can signals export params
func (o *GetCanSignalsExportParams) SetCanSignals(canSignals []string) {
	o.CanSignals = canSignals
}

// WithSelectAll adds the selectAll to the get can signals export params
func (o *GetCanSignalsExportParams) WithSelectAll(selectAll *bool) *GetCanSignalsExportParams {
	o.SetSelectAll(selectAll)
	return o
}

// SetSelectAll adds the selectAll to the get can signals export params
func (o *GetCanSignalsExportParams) SetSelectAll(selectAll *bool) {
	o.SelectAll = selectAll
}

// WithTimestampEnd adds the timestampEnd to the get can signals export params
func (o *GetCanSignalsExportParams) WithTimestampEnd(timestampEnd float64) *GetCanSignalsExportParams {
	o.SetTimestampEnd(timestampEnd)
	return o
}

// SetTimestampEnd adds the timestampEnd to the get can signals export params
func (o *GetCanSignalsExportParams) SetTimestampEnd(timestampEnd float64) {
	o.TimestampEnd = timestampEnd
}

// WithTimestampStart adds the timestampStart to the get can signals export params
func (o *GetCanSignalsExportParams) WithTimestampStart(timestampStart float64) *GetCanSignalsExportParams {
	o.SetTimestampStart(timestampStart)
	return o
}

// SetTimestampStart adds the timestampStart to the get can signals export params
func (o *GetCanSignalsExportParams) SetTimestampStart(timestampStart float64) {
	o.TimestampStart = timestampStart
}

// WithVin adds the vin to the get can signals export params
func (o *GetCanSignalsExportParams) WithVin(vin string) *GetCanSignalsExportParams {
	o.SetVin(vin)
	return o
}

// SetVin adds the vin to the get can signals export params
func (o *GetCanSignalsExportParams) SetVin(vin string) {
	o.Vin = vin
}

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

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

	if o.CanSignals != nil {

		// binding items for can_signals
		joinedCanSignals := o.bindParamCanSignals(reg)

		// query array param can_signals
		if err := r.SetQueryParam("can_signals", joinedCanSignals...); err != nil {
			return err
		}
	}

	if o.SelectAll != nil {

		// query param select_all
		var qrSelectAll bool

		if o.SelectAll != nil {
			qrSelectAll = *o.SelectAll
		}
		qSelectAll := swag.FormatBool(qrSelectAll)
		if qSelectAll != "" {

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

	// query param timestamp_end
	qrTimestampEnd := o.TimestampEnd
	qTimestampEnd := swag.FormatFloat64(qrTimestampEnd)
	if qTimestampEnd != "" {

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

	// query param timestamp_start
	qrTimestampStart := o.TimestampStart
	qTimestampStart := swag.FormatFloat64(qrTimestampStart)
	if qTimestampStart != "" {

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

// bindParamGetCanSignalsExport binds the parameter can_signals
func (o *GetCanSignalsExportParams) bindParamCanSignals(formats strfmt.Registry) []string {
	canSignalsIR := o.CanSignals

	var canSignalsIC []string
	for _, canSignalsIIR := range canSignalsIR { // explode []string

		canSignalsIIV := canSignalsIIR // string as string
		canSignalsIC = append(canSignalsIC, canSignalsIIV)
	}

	// items.CollectionFormat: ""
	canSignalsIS := swag.JoinByFormat(canSignalsIC, "")

	return canSignalsIS
}
