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

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

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

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

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

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

	for the get carslocations operation.

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

	/* Order.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	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 len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
