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

// NewPostTenantMembershipParams creates a new PostTenantMembershipParams 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 NewPostTenantMembershipParams() *PostTenantMembershipParams {
	return NewPostTenantMembershipParamsWithTimeout(cr.DefaultTimeout)
}

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

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

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

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

	for the post tenant membership operation.

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

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

	// Request.
	Request *members_models.TenantMembershipCreateRequest

	HTTPClient *http.Client

	inner innerParams
}

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

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

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

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

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

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

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

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

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

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

// WithRequest adds the request to the post tenant membership params.
func (o *PostTenantMembershipParams) WithRequest(request *members_models.TenantMembershipCreateRequest) *PostTenantMembershipParams {
	o.SetRequest(request)
	return o
}

// SetRequest adds the request to the post tenant membership params.
func (o *PostTenantMembershipParams) SetRequest(request *members_models.TenantMembershipCreateRequest) {
	o.Request = request
}

// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *PostTenantMembershipParams) 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
		}
	}
	if o.Request != nil {
		if err := r.SetBodyParam(o.Request); err != nil {
			return err
		}
	}

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