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

package unannotated_echo_service

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/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/unannotatedecho/models"
)

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

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

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

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

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

	for the unannotated echo service echo nested operation.

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

	/* Body.

	   A simple message with many types
	*/
	Body *models.ExamplepbUnannotatedSimpleMessage

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

// WithDefaults hydrates default values in the unannotated echo service echo nested params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UnannotatedEchoServiceEchoNestedParams) WithDefaults() *UnannotatedEchoServiceEchoNestedParams {
	o.SetDefaults()
	return o
}

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

// WithTimeout adds the timeout to the unannotated echo service echo nested params
func (o *UnannotatedEchoServiceEchoNestedParams) WithTimeout(timeout time.Duration) *UnannotatedEchoServiceEchoNestedParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the unannotated echo service echo nested params
func (o *UnannotatedEchoServiceEchoNestedParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the unannotated echo service echo nested params
func (o *UnannotatedEchoServiceEchoNestedParams) WithContext(ctx context.Context) *UnannotatedEchoServiceEchoNestedParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the unannotated echo service echo nested params
func (o *UnannotatedEchoServiceEchoNestedParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the unannotated echo service echo nested params
func (o *UnannotatedEchoServiceEchoNestedParams) WithHTTPClient(client *http.Client) *UnannotatedEchoServiceEchoNestedParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the unannotated echo service echo nested params
func (o *UnannotatedEchoServiceEchoNestedParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithBody adds the body to the unannotated echo service echo nested params
func (o *UnannotatedEchoServiceEchoNestedParams) WithBody(body *models.ExamplepbUnannotatedSimpleMessage) *UnannotatedEchoServiceEchoNestedParams {
	o.SetBody(body)
	return o
}

// SetBody adds the body to the unannotated echo service echo nested params
func (o *UnannotatedEchoServiceEchoNestedParams) SetBody(body *models.ExamplepbUnannotatedSimpleMessage) {
	o.Body = body
}

// WriteToRequest writes these params to a swagger request
func (o *UnannotatedEchoServiceEchoNestedParams) 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 len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
