// Code generated by go-swagger; DO NOT EDIT.

package security_certificates

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

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

// NewRetrieveCertificateParams creates a new RetrieveCertificateParams 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 NewRetrieveCertificateParams() *RetrieveCertificateParams {
	return &RetrieveCertificateParams{
		timeout: cr.DefaultTimeout,
	}
}

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

// NewRetrieveCertificateParamsWithContext creates a new RetrieveCertificateParams object
// with the ability to set a context for a request.
func NewRetrieveCertificateParamsWithContext(ctx context.Context) *RetrieveCertificateParams {
	return &RetrieveCertificateParams{
		Context: ctx,
	}
}

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

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

	for the retrieve certificate operation.

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

	/* Host.

	   The remote system's host name
	*/
	Host string

	/* Port.

	   The port on the remote system to connect to

	   Format: int32
	   Default: 443
	*/
	Port *int32

	/* ProtocolHint.

	   An optional hint of the protocol to try for the connection
	*/
	ProtocolHint *string

	timeout    time.Duration
	Context    context.Context
	HTTPClient *http.Client
}

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

// SetDefaults hydrates default values in the retrieve certificate params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *RetrieveCertificateParams) SetDefaults() {
	var (
		portDefault = int32(443)
	)

	val := RetrieveCertificateParams{
		Port: &portDefault,
	}

	val.timeout = o.timeout
	val.Context = o.Context
	val.HTTPClient = o.HTTPClient
	*o = val
}

// WithTimeout adds the timeout to the retrieve certificate params
func (o *RetrieveCertificateParams) WithTimeout(timeout time.Duration) *RetrieveCertificateParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the retrieve certificate params
func (o *RetrieveCertificateParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the retrieve certificate params
func (o *RetrieveCertificateParams) WithContext(ctx context.Context) *RetrieveCertificateParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the retrieve certificate params
func (o *RetrieveCertificateParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the retrieve certificate params
func (o *RetrieveCertificateParams) WithHTTPClient(client *http.Client) *RetrieveCertificateParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the retrieve certificate params
func (o *RetrieveCertificateParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithHost adds the host to the retrieve certificate params
func (o *RetrieveCertificateParams) WithHost(host string) *RetrieveCertificateParams {
	o.SetHost(host)
	return o
}

// SetHost adds the host to the retrieve certificate params
func (o *RetrieveCertificateParams) SetHost(host string) {
	o.Host = host
}

// WithPort adds the port to the retrieve certificate params
func (o *RetrieveCertificateParams) WithPort(port *int32) *RetrieveCertificateParams {
	o.SetPort(port)
	return o
}

// SetPort adds the port to the retrieve certificate params
func (o *RetrieveCertificateParams) SetPort(port *int32) {
	o.Port = port
}

// WithProtocolHint adds the protocolHint to the retrieve certificate params
func (o *RetrieveCertificateParams) WithProtocolHint(protocolHint *string) *RetrieveCertificateParams {
	o.SetProtocolHint(protocolHint)
	return o
}

// SetProtocolHint adds the protocolHint to the retrieve certificate params
func (o *RetrieveCertificateParams) SetProtocolHint(protocolHint *string) {
	o.ProtocolHint = protocolHint
}

// WriteToRequest writes these params to a swagger request
func (o *RetrieveCertificateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {

	if err := r.SetTimeout(o.timeout); err != nil {
		return err
	}
	var res []error

	// query param host
	qrHost := o.Host
	qHost := qrHost
	if qHost != "" {

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

	if o.Port != nil {

		// query param port
		var qrPort int32

		if o.Port != nil {
			qrPort = *o.Port
		}
		qPort := swag.FormatInt32(qrPort)
		if qPort != "" {

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

	if o.ProtocolHint != nil {

		// query param protocolHint
		var qrProtocolHint string

		if o.ProtocolHint != nil {
			qrProtocolHint = *o.ProtocolHint
		}
		qProtocolHint := qrProtocolHint
		if qProtocolHint != "" {

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

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