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

package 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/echo/models"
)

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

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

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

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

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

	for the echo service echo body2 operation.

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

	/* ID.

	   Id represents the message identifier.
	*/
	ID string

	// Lang.
	Lang *string

	// LineNum.
	//
	// Format: int64
	LineNum *string

	// NIDnID.
	NIDnID *string

	// NIDVal.
	NIDVal *string

	// No.
	No *models.ExamplepbEmbedded

	// Num.
	//
	// Format: int64
	Num *string

	// ResourceID.
	ResourceID *string

	// StatusNote.
	StatusNote *string

	// StatusProgress.
	//
	// Format: int64
	StatusProgress *string

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

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

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

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

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

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

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

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

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

// WithID adds the id to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) WithID(id string) *EchoServiceEchoBody2Params {
	o.SetID(id)
	return o
}

// SetID adds the id to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) SetID(id string) {
	o.ID = id
}

// WithLang adds the lang to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) WithLang(lang *string) *EchoServiceEchoBody2Params {
	o.SetLang(lang)
	return o
}

// SetLang adds the lang to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) SetLang(lang *string) {
	o.Lang = lang
}

// WithLineNum adds the lineNum to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) WithLineNum(lineNum *string) *EchoServiceEchoBody2Params {
	o.SetLineNum(lineNum)
	return o
}

// SetLineNum adds the lineNum to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) SetLineNum(lineNum *string) {
	o.LineNum = lineNum
}

// WithNIDnID adds the nIDnID to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) WithNIDnID(nIDnID *string) *EchoServiceEchoBody2Params {
	o.SetNIDnID(nIDnID)
	return o
}

// SetNIDnID adds the nIdNId to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) SetNIDnID(nIDnID *string) {
	o.NIDnID = nIDnID
}

// WithNIDVal adds the nIDVal to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) WithNIDVal(nIDVal *string) *EchoServiceEchoBody2Params {
	o.SetNIDVal(nIDVal)
	return o
}

// SetNIDVal adds the nIdVal to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) SetNIDVal(nIDVal *string) {
	o.NIDVal = nIDVal
}

// WithNo adds the no to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) WithNo(no *models.ExamplepbEmbedded) *EchoServiceEchoBody2Params {
	o.SetNo(no)
	return o
}

// SetNo adds the no to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) SetNo(no *models.ExamplepbEmbedded) {
	o.No = no
}

// WithNum adds the num to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) WithNum(num *string) *EchoServiceEchoBody2Params {
	o.SetNum(num)
	return o
}

// SetNum adds the num to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) SetNum(num *string) {
	o.Num = num
}

// WithResourceID adds the resourceID to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) WithResourceID(resourceID *string) *EchoServiceEchoBody2Params {
	o.SetResourceID(resourceID)
	return o
}

// SetResourceID adds the resourceId to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) SetResourceID(resourceID *string) {
	o.ResourceID = resourceID
}

// WithStatusNote adds the statusNote to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) WithStatusNote(statusNote *string) *EchoServiceEchoBody2Params {
	o.SetStatusNote(statusNote)
	return o
}

// SetStatusNote adds the statusNote to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) SetStatusNote(statusNote *string) {
	o.StatusNote = statusNote
}

// WithStatusProgress adds the statusProgress to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) WithStatusProgress(statusProgress *string) *EchoServiceEchoBody2Params {
	o.SetStatusProgress(statusProgress)
	return o
}

// SetStatusProgress adds the statusProgress to the echo service echo body2 params
func (o *EchoServiceEchoBody2Params) SetStatusProgress(statusProgress *string) {
	o.StatusProgress = statusProgress
}

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

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

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

	if o.Lang != nil {

		// query param lang
		var qrLang string

		if o.Lang != nil {
			qrLang = *o.Lang
		}
		qLang := qrLang
		if qLang != "" {

			if err := r.SetQueryParam("lang", qLang); err != nil {
				return err
			}
		}
	}

	if o.LineNum != nil {

		// query param lineNum
		var qrLineNum string

		if o.LineNum != nil {
			qrLineNum = *o.LineNum
		}
		qLineNum := qrLineNum
		if qLineNum != "" {

			if err := r.SetQueryParam("lineNum", qLineNum); err != nil {
				return err
			}
		}
	}

	if o.NIDnID != nil {

		// query param nId.nId
		var qrNIDnID string

		if o.NIDnID != nil {
			qrNIDnID = *o.NIDnID
		}
		qNIDnID := qrNIDnID
		if qNIDnID != "" {

			if err := r.SetQueryParam("nId.nId", qNIDnID); err != nil {
				return err
			}
		}
	}

	if o.NIDVal != nil {

		// query param nId.val
		var qrNIDVal string

		if o.NIDVal != nil {
			qrNIDVal = *o.NIDVal
		}
		qNIDVal := qrNIDVal
		if qNIDVal != "" {

			if err := r.SetQueryParam("nId.val", qNIDVal); err != nil {
				return err
			}
		}
	}
	if o.No != nil {
		if err := r.SetBodyParam(o.No); err != nil {
			return err
		}
	}

	if o.Num != nil {

		// query param num
		var qrNum string

		if o.Num != nil {
			qrNum = *o.Num
		}
		qNum := qrNum
		if qNum != "" {

			if err := r.SetQueryParam("num", qNum); err != nil {
				return err
			}
		}
	}

	if o.ResourceID != nil {

		// query param resourceId
		var qrResourceID string

		if o.ResourceID != nil {
			qrResourceID = *o.ResourceID
		}
		qResourceID := qrResourceID
		if qResourceID != "" {

			if err := r.SetQueryParam("resourceId", qResourceID); err != nil {
				return err
			}
		}
	}

	if o.StatusNote != nil {

		// query param status.note
		var qrStatusNote string

		if o.StatusNote != nil {
			qrStatusNote = *o.StatusNote
		}
		qStatusNote := qrStatusNote
		if qStatusNote != "" {

			if err := r.SetQueryParam("status.note", qStatusNote); err != nil {
				return err
			}
		}
	}

	if o.StatusProgress != nil {

		// query param status.progress
		var qrStatusProgress string

		if o.StatusProgress != nil {
			qrStatusProgress = *o.StatusProgress
		}
		qStatusProgress := qrStatusProgress
		if qStatusProgress != "" {

			if err := r.SetQueryParam("status.progress", qStatusProgress); err != nil {
				return err
			}
		}
	}

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