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

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

// NewGetLeadsParams creates a new GetLeadsParams 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 NewGetLeadsParams() *GetLeadsParams {
	return NewGetLeadsParamsWithTimeout(cr.DefaultTimeout)
}

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

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

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

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

	for the get leads operation.

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

	// Email.
	//
	// Email address used for identity lookup
	Email *string

	// LeadID.
	//
	// Lead record ID
	LeadID *string

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

	// Name.
	//
	// The Name of this Object
	Name *string

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

	HTTPClient *http.Client

	inner innerParams
}

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

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

// WithTimeout adds the timeout to the get leads params.
func (o *GetLeadsParams) WithTimeout(timeout time.Duration) *GetLeadsParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the get leads params.
func (o *GetLeadsParams) SetTimeout(timeout time.Duration) {
	o.inner.timeout = timeout
}

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

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

// WithHTTPClient adds the HTTPClient to the get leads params.
func (o *GetLeadsParams) WithHTTPClient(client *http.Client) *GetLeadsParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the get leads params.
func (o *GetLeadsParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithEmail adds the email to the get leads params.
func (o *GetLeadsParams) WithEmail(email *string) *GetLeadsParams {
	o.SetEmail(email)
	return o
}

// SetEmail adds the email to the get leads params.
func (o *GetLeadsParams) SetEmail(email *string) {
	o.Email = email
}

// WithLeadID adds the leadID to the get leads params.
func (o *GetLeadsParams) WithLeadID(leadID *string) *GetLeadsParams {
	o.SetLeadID(leadID)
	return o
}

// SetLeadID adds the leadId to the get leads params.
func (o *GetLeadsParams) SetLeadID(leadID *string) {
	o.LeadID = leadID
}

// WithLimit adds the limit to the get leads params.
func (o *GetLeadsParams) WithLimit(limit *int64) *GetLeadsParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the get leads params.
func (o *GetLeadsParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithName adds the name to the get leads params.
func (o *GetLeadsParams) WithName(name *string) *GetLeadsParams {
	o.SetName(name)
	return o
}

// SetName adds the name to the get leads params.
func (o *GetLeadsParams) SetName(name *string) {
	o.Name = name
}

// WithOffset adds the offset to the get leads params.
func (o *GetLeadsParams) WithOffset(offset *int64) *GetLeadsParams {
	o.SetOffset(offset)
	return o
}

// SetOffset adds the offset to the get leads params.
func (o *GetLeadsParams) SetOffset(offset *int64) {
	o.Offset = offset
}

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

	if o.Email != nil {

		// query param email
		var qrEmail string

		if o.Email != nil {
			qrEmail = *o.Email
		}
		qEmail := qrEmail
		if qEmail != "" {

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

	if o.LeadID != nil {

		// query param leadId
		var qrLeadID string

		if o.LeadID != nil {
			qrLeadID = *o.LeadID
		}
		qLeadID := qrLeadID
		if qLeadID != "" {

			if err := r.SetQueryParam("leadId", qLeadID); 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.Name != nil {

		// query param name
		var qrName string

		if o.Name != nil {
			qrName = *o.Name
		}
		qName := qrName
		if qName != "" {

			if err := r.SetQueryParam("name", qName); 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
			}
		}
	}

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