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

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/go-openapi/swag/conv"
)

// NewGetCompanyProductProposalsParams creates a new GetCompanyProductProposalsParams 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 NewGetCompanyProductProposalsParams() *GetCompanyProductProposalsParams {
	return NewGetCompanyProductProposalsParamsWithTimeout(cr.DefaultTimeout)
}

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

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

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

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

	for the get company product proposals operation.

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

	// CompanyProductID.
	//
	// CompanyProduct record ID
	CompanyProductID *string

	// Limit.
	//
	// How many objects to return at one time
	//
	// Format: int64
	Limit *int64

	// Offset.
	//
	// How many objects to skip?
	//
	// Format: int64
	Offset *int64

	// View.
	//
	// Actor-owned proposals or the tenant review queue
	View string

	HTTPClient *http.Client

	inner innerParams
}

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

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

// WithTimeout adds the timeout to the get company product proposals params.
func (o *GetCompanyProductProposalsParams) WithTimeout(timeout time.Duration) *GetCompanyProductProposalsParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the get company product proposals params.
func (o *GetCompanyProductProposalsParams) SetTimeout(timeout time.Duration) {
	o.inner.timeout = timeout
}

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

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

// WithHTTPClient adds the HTTPClient to the get company product proposals params.
func (o *GetCompanyProductProposalsParams) WithHTTPClient(client *http.Client) *GetCompanyProductProposalsParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the get company product proposals params.
func (o *GetCompanyProductProposalsParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithCompanyProductID adds the companyProductID to the get company product proposals params.
func (o *GetCompanyProductProposalsParams) WithCompanyProductID(companyProductID *string) *GetCompanyProductProposalsParams {
	o.SetCompanyProductID(companyProductID)
	return o
}

// SetCompanyProductID adds the companyProductId to the get company product proposals params.
func (o *GetCompanyProductProposalsParams) SetCompanyProductID(companyProductID *string) {
	o.CompanyProductID = companyProductID
}

// WithLimit adds the limit to the get company product proposals params.
func (o *GetCompanyProductProposalsParams) WithLimit(limit *int64) *GetCompanyProductProposalsParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the get company product proposals params.
func (o *GetCompanyProductProposalsParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithOffset adds the offset to the get company product proposals params.
func (o *GetCompanyProductProposalsParams) WithOffset(offset *int64) *GetCompanyProductProposalsParams {
	o.SetOffset(offset)
	return o
}

// SetOffset adds the offset to the get company product proposals params.
func (o *GetCompanyProductProposalsParams) SetOffset(offset *int64) {
	o.Offset = offset
}

// WithView adds the view to the get company product proposals params.
func (o *GetCompanyProductProposalsParams) WithView(view string) *GetCompanyProductProposalsParams {
	o.SetView(view)
	return o
}

// SetView adds the view to the get company product proposals params.
func (o *GetCompanyProductProposalsParams) SetView(view string) {
	o.View = view
}

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

	if o.CompanyProductID != nil {

		// query param companyProductId
		var qrCompanyProductID string

		if o.CompanyProductID != nil {
			qrCompanyProductID = *o.CompanyProductID
		}
		qCompanyProductID := qrCompanyProductID
		if qCompanyProductID != "" {

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

	if o.Limit != nil {

		// query param limit
		var qrLimit int64

		if o.Limit != nil {
			qrLimit = *o.Limit
		}
		qLimit := conv.FormatInteger(qrLimit)
		if qLimit != "" {

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

	if o.Offset != nil {

		// query param offset
		var qrOffset int64

		if o.Offset != nil {
			qrOffset = *o.Offset
		}
		qOffset := conv.FormatInteger(qrOffset)
		if qOffset != "" {

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

	// query param view
	qrView := o.View
	qView := qrView
	if qView != "" {

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

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