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

	"github.com/fiskerinc/cloud-services/pkg/ota_api/models"
)

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

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

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

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

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

	for the put manifest operation.

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

	/* ID.

	   Update manifest id
	*/
	ID *int64

	/* Manifest.

	   Manifest data
	*/
	Manifest *models.CommonUpdateManifestUpdateRequest

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

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

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

// WithTimeout adds the timeout to the put manifest params
func (o *PutManifestParams) WithTimeout(timeout time.Duration) *PutManifestParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the put manifest params
func (o *PutManifestParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the put manifest params
func (o *PutManifestParams) WithContext(ctx context.Context) *PutManifestParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the put manifest params
func (o *PutManifestParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the put manifest params
func (o *PutManifestParams) WithHTTPClient(client *http.Client) *PutManifestParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the put manifest params
func (o *PutManifestParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithID adds the id to the put manifest params
func (o *PutManifestParams) WithID(id *int64) *PutManifestParams {
	o.SetID(id)
	return o
}

// SetID adds the id to the put manifest params
func (o *PutManifestParams) SetID(id *int64) {
	o.ID = id
}

// WithManifest adds the manifest to the put manifest params
func (o *PutManifestParams) WithManifest(manifest *models.CommonUpdateManifestUpdateRequest) *PutManifestParams {
	o.SetManifest(manifest)
	return o
}

// SetManifest adds the manifest to the put manifest params
func (o *PutManifestParams) SetManifest(manifest *models.CommonUpdateManifestUpdateRequest) {
	o.Manifest = manifest
}

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

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

	if o.ID != nil {

		// query param id
		var qrID int64

		if o.ID != nil {
			qrID = *o.ID
		}
		qID := swag.FormatInt64(qrID)
		if qID != "" {

			if err := r.SetQueryParam("id", qID); err != nil {
				return err
			}
		}
	}
	if o.Manifest != nil {
		if err := r.SetBodyParam(o.Manifest); err != nil {
			return err
		}
	}

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