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

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

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

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

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

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

	for the get flashpack version ecu mappings model trim year flashpack operation.

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

	/* Flashpack.

	   Flashpack
	*/
	Flashpack string

	/* Limit.

	   Max number of records
	*/
	Limit *int64

	/* Model.

	   Model
	*/
	Model string

	/* Offset.

	   Records offset
	*/
	Offset *int64

	/* Trim.

	   Trim
	*/
	Trim string

	/* Year.

	   Year
	*/
	Year int64

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

// WithDefaults hydrates default values in the get flashpack version ecu mappings model trim year flashpack params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) WithDefaults() *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the get flashpack version ecu mappings model trim year flashpack params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) SetDefaults() {
	// no default values defined for this parameter
}

// WithTimeout adds the timeout to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) WithTimeout(timeout time.Duration) *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) WithContext(ctx context.Context) *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) WithHTTPClient(client *http.Client) *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithFlashpack adds the flashpack to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) WithFlashpack(flashpack string) *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams {
	o.SetFlashpack(flashpack)
	return o
}

// SetFlashpack adds the flashpack to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) SetFlashpack(flashpack string) {
	o.Flashpack = flashpack
}

// WithLimit adds the limit to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) WithLimit(limit *int64) *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithModel adds the model to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) WithModel(model string) *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams {
	o.SetModel(model)
	return o
}

// SetModel adds the model to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) SetModel(model string) {
	o.Model = model
}

// WithOffset adds the offset to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) WithOffset(offset *int64) *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams {
	o.SetOffset(offset)
	return o
}

// SetOffset adds the offset to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) SetOffset(offset *int64) {
	o.Offset = offset
}

// WithTrim adds the trim to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) WithTrim(trim string) *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams {
	o.SetTrim(trim)
	return o
}

// SetTrim adds the trim to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) SetTrim(trim string) {
	o.Trim = trim
}

// WithYear adds the year to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) WithYear(year int64) *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams {
	o.SetYear(year)
	return o
}

// SetYear adds the year to the get flashpack version ecu mappings model trim year flashpack params
func (o *GetFlashpackVersionEcuMappingsModelTrimYearFlashpackParams) SetYear(year int64) {
	o.Year = year
}

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

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

	// path param flashpack
	if err := r.SetPathParam("flashpack", o.Flashpack); 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 model
	if err := r.SetPathParam("model", o.Model); 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
			}
		}
	}

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

	// path param year
	if err := r.SetPathParam("year", swag.FormatInt64(o.Year)); err != nil {
		return err
	}

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