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

// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package portal_memberships

import (
	"context"
	"net/http"
	"time"

	"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
	"github.com/go-openapi/errors"
	"github.com/go-openapi/runtime"
	cr "github.com/go-openapi/runtime/client"
	"github.com/go-openapi/strfmt"
)

// NewPutTenantMembershipParams creates a new PutTenantMembershipParams 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 NewPutTenantMembershipParams() *PutTenantMembershipParams {
	return NewPutTenantMembershipParamsWithTimeout(cr.DefaultTimeout)
}

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

// NewPutTenantMembershipParamsWithContext creates a new PutTenantMembershipParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [PutTenantMembershipParams].
func NewPutTenantMembershipParamsWithContext(ctx context.Context) *PutTenantMembershipParams {
	return &PutTenantMembershipParams{
		inner: innerParams{
			ctx: ctx,
		},
	}
}

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

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

	for the put tenant membership operation.

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

	// XRequestID.
	//
	// Optional bounded correlation identifier stored with membership audit events.
	XRequestID *string

	// MembershipID.
	//
	// Format: uuid
	MembershipID strfmt.UUID

	// Request.
	Request *members_models.TenantMembershipUpdateRequest

	HTTPClient *http.Client

	inner innerParams
}

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

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

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

// SetTimeout adds the timeout to the put tenant membership params.
func (o *PutTenantMembershipParams) SetTimeout(timeout time.Duration) {
	o.inner.timeout = timeout
}

// WithContext adds the context to the put tenant membership params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutTenantMembershipParams].
func (o *PutTenantMembershipParams) WithContext(ctx context.Context) *PutTenantMembershipParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the put tenant membership params.
//
// Deprecated: use the operation call with context to pass the context instead of [PutTenantMembershipParams].
func (o *PutTenantMembershipParams) SetContext(ctx context.Context) {
	o.inner.ctx = ctx
}

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

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

// WithXRequestID adds the xRequestID to the put tenant membership params.
func (o *PutTenantMembershipParams) WithXRequestID(xRequestID *string) *PutTenantMembershipParams {
	o.SetXRequestID(xRequestID)
	return o
}

// SetXRequestID adds the xRequestId to the put tenant membership params.
func (o *PutTenantMembershipParams) SetXRequestID(xRequestID *string) {
	o.XRequestID = xRequestID
}

// WithMembershipID adds the membershipID to the put tenant membership params.
func (o *PutTenantMembershipParams) WithMembershipID(membershipID strfmt.UUID) *PutTenantMembershipParams {
	o.SetMembershipID(membershipID)
	return o
}

// SetMembershipID adds the membershipId to the put tenant membership params.
func (o *PutTenantMembershipParams) SetMembershipID(membershipID strfmt.UUID) {
	o.MembershipID = membershipID
}

// WithRequest adds the request to the put tenant membership params.
func (o *PutTenantMembershipParams) WithRequest(request *members_models.TenantMembershipUpdateRequest) *PutTenantMembershipParams {
	o.SetRequest(request)
	return o
}

// SetRequest adds the request to the put tenant membership params.
func (o *PutTenantMembershipParams) SetRequest(request *members_models.TenantMembershipUpdateRequest) {
	o.Request = request
}

// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PutTenantMembershipParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
	if err := r.SetTimeout(o.inner.timeout); err != nil {
		return err
	}
	var res []error

	if o.XRequestID != nil {

		// header param X-Request-ID
		if err := r.SetHeaderParam("X-Request-ID", *o.XRequestID); err != nil {
			return err
		}
	}

	// path param membershipId
	if err := r.SetPathParam("membershipId", o.MembershipID.String()); err != nil {
		return err
	}
	if o.Request != nil {
		if err := r.SetBodyParam(o.Request); err != nil {
			return err
		}
	}

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