// 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 factors

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

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

// NewPutFactorParams creates a new PutFactorParams 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 NewPutFactorParams() *PutFactorParams {
	return NewPutFactorParamsWithTimeout(cr.DefaultTimeout)
}

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

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

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

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

	for the put factor operation.

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

	// FactorRequest.
	//
	// An array of new Factor records
	FactorRequest *research_models.FactorRequest

	HTTPClient *http.Client

	inner innerParams
}

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

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

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

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

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

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

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

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

// WithFactorRequest adds the factorRequest to the put factor params.
func (o *PutFactorParams) WithFactorRequest(factorRequest *research_models.FactorRequest) *PutFactorParams {
	o.SetFactorRequest(factorRequest)
	return o
}

// SetFactorRequest adds the factorRequest to the put factor params.
func (o *PutFactorParams) SetFactorRequest(factorRequest *research_models.FactorRequest) {
	o.FactorRequest = factorRequest
}

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

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