// Code generated by go-swagger; DO NOT EDIT.

package consul_service

// 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/hashicorp/hcp-sdk-go/clients/cloud-consul-service/stable/2020-08-26/models"
)

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

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

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

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

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

	for the update snapshot operation.

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

	/* Body.

	     snapshot contains the fields to update.

	Supported fields: name
	*/
	Body *models.HashicorpCloudConsul20200826Snapshot

	/* MaskPaths.

	   The set of field mask paths.
	*/
	MaskPaths []string

	/* SnapshotID.

	   id is the snapshot’s ID.
	*/
	SnapshotID string

	/* SnapshotLocationOrganizationID.

	   organization_id is the id of the organization.
	*/
	SnapshotLocationOrganizationID string

	/* SnapshotLocationProjectID.

	   project_id is the projects id.
	*/
	SnapshotLocationProjectID string

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

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

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

// WithTimeout adds the timeout to the update snapshot params
func (o *UpdateSnapshotParams) WithTimeout(timeout time.Duration) *UpdateSnapshotParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the update snapshot params
func (o *UpdateSnapshotParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the update snapshot params
func (o *UpdateSnapshotParams) WithContext(ctx context.Context) *UpdateSnapshotParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the update snapshot params
func (o *UpdateSnapshotParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the update snapshot params
func (o *UpdateSnapshotParams) WithHTTPClient(client *http.Client) *UpdateSnapshotParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the update snapshot params
func (o *UpdateSnapshotParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithBody adds the body to the update snapshot params
func (o *UpdateSnapshotParams) WithBody(body *models.HashicorpCloudConsul20200826Snapshot) *UpdateSnapshotParams {
	o.SetBody(body)
	return o
}

// SetBody adds the body to the update snapshot params
func (o *UpdateSnapshotParams) SetBody(body *models.HashicorpCloudConsul20200826Snapshot) {
	o.Body = body
}

// WithMaskPaths adds the maskPaths to the update snapshot params
func (o *UpdateSnapshotParams) WithMaskPaths(maskPaths []string) *UpdateSnapshotParams {
	o.SetMaskPaths(maskPaths)
	return o
}

// SetMaskPaths adds the maskPaths to the update snapshot params
func (o *UpdateSnapshotParams) SetMaskPaths(maskPaths []string) {
	o.MaskPaths = maskPaths
}

// WithSnapshotID adds the snapshotID to the update snapshot params
func (o *UpdateSnapshotParams) WithSnapshotID(snapshotID string) *UpdateSnapshotParams {
	o.SetSnapshotID(snapshotID)
	return o
}

// SetSnapshotID adds the snapshotId to the update snapshot params
func (o *UpdateSnapshotParams) SetSnapshotID(snapshotID string) {
	o.SnapshotID = snapshotID
}

// WithSnapshotLocationOrganizationID adds the snapshotLocationOrganizationID to the update snapshot params
func (o *UpdateSnapshotParams) WithSnapshotLocationOrganizationID(snapshotLocationOrganizationID string) *UpdateSnapshotParams {
	o.SetSnapshotLocationOrganizationID(snapshotLocationOrganizationID)
	return o
}

// SetSnapshotLocationOrganizationID adds the snapshotLocationOrganizationId to the update snapshot params
func (o *UpdateSnapshotParams) SetSnapshotLocationOrganizationID(snapshotLocationOrganizationID string) {
	o.SnapshotLocationOrganizationID = snapshotLocationOrganizationID
}

// WithSnapshotLocationProjectID adds the snapshotLocationProjectID to the update snapshot params
func (o *UpdateSnapshotParams) WithSnapshotLocationProjectID(snapshotLocationProjectID string) *UpdateSnapshotParams {
	o.SetSnapshotLocationProjectID(snapshotLocationProjectID)
	return o
}

// SetSnapshotLocationProjectID adds the snapshotLocationProjectId to the update snapshot params
func (o *UpdateSnapshotParams) SetSnapshotLocationProjectID(snapshotLocationProjectID string) {
	o.SnapshotLocationProjectID = snapshotLocationProjectID
}

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

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

	if o.MaskPaths != nil {

		// binding items for mask.paths
		joinedMaskPaths := o.bindParamMaskPaths(reg)

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

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

	// path param snapshot.location.organization_id
	if err := r.SetPathParam("snapshot.location.organization_id", o.SnapshotLocationOrganizationID); err != nil {
		return err
	}

	// path param snapshot.location.project_id
	if err := r.SetPathParam("snapshot.location.project_id", o.SnapshotLocationProjectID); err != nil {
		return err
	}

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

// bindParamUpdateSnapshot binds the parameter mask.paths
func (o *UpdateSnapshotParams) bindParamMaskPaths(formats strfmt.Registry) []string {
	maskPathsIR := o.MaskPaths

	var maskPathsIC []string
	for _, maskPathsIIR := range maskPathsIR { // explode []string

		maskPathsIIV := maskPathsIIR // string as string
		maskPathsIC = append(maskPathsIC, maskPathsIIV)
	}

	// items.CollectionFormat: "multi"
	maskPathsIS := swag.JoinByFormat(maskPathsIC, "multi")

	return maskPathsIS
}
