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

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

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

// NewPostCompanyProductsParams creates a new PostCompanyProductsParams 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 NewPostCompanyProductsParams() *PostCompanyProductsParams {
	return NewPostCompanyProductsParamsWithTimeout(cr.DefaultTimeout)
}

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

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

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

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

	for the post company products operation.

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

	// ContactRequest.
	//
	// An array of new Contact records
	ContactRequest *sfgate_models.CompanyProductRequest

	HTTPClient *http.Client

	inner innerParams
}

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

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

// WithTimeout adds the timeout to the post company products params.
func (o *PostCompanyProductsParams) WithTimeout(timeout time.Duration) *PostCompanyProductsParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the post company products params.
func (o *PostCompanyProductsParams) SetTimeout(timeout time.Duration) {
	o.inner.timeout = timeout
}

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

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

// WithHTTPClient adds the HTTPClient to the post company products params.
func (o *PostCompanyProductsParams) WithHTTPClient(client *http.Client) *PostCompanyProductsParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the post company products params.
func (o *PostCompanyProductsParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithContactRequest adds the contactRequest to the post company products params.
func (o *PostCompanyProductsParams) WithContactRequest(contactRequest *sfgate_models.CompanyProductRequest) *PostCompanyProductsParams {
	o.SetContactRequest(contactRequest)
	return o
}

// SetContactRequest adds the contactRequest to the post company products params.
func (o *PostCompanyProductsParams) SetContactRequest(contactRequest *sfgate_models.CompanyProductRequest) {
	o.ContactRequest = contactRequest
}

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

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