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

package enterprises

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

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

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

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

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

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

	for the list enterprises operation.

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

	/* Endpoint.

	   Exact endpoint name to filter by
	*/
	Endpoint *string

	/* Name.

	   Exact enterprise name to filter by
	*/
	Name *string

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

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

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

// WithTimeout adds the timeout to the list enterprises params
func (o *ListEnterprisesParams) WithTimeout(timeout time.Duration) *ListEnterprisesParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the list enterprises params
func (o *ListEnterprisesParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the list enterprises params
func (o *ListEnterprisesParams) WithContext(ctx context.Context) *ListEnterprisesParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the list enterprises params
func (o *ListEnterprisesParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the list enterprises params
func (o *ListEnterprisesParams) WithHTTPClient(client *http.Client) *ListEnterprisesParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the list enterprises params
func (o *ListEnterprisesParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithEndpoint adds the endpoint to the list enterprises params
func (o *ListEnterprisesParams) WithEndpoint(endpoint *string) *ListEnterprisesParams {
	o.SetEndpoint(endpoint)
	return o
}

// SetEndpoint adds the endpoint to the list enterprises params
func (o *ListEnterprisesParams) SetEndpoint(endpoint *string) {
	o.Endpoint = endpoint
}

// WithName adds the name to the list enterprises params
func (o *ListEnterprisesParams) WithName(name *string) *ListEnterprisesParams {
	o.SetName(name)
	return o
}

// SetName adds the name to the list enterprises params
func (o *ListEnterprisesParams) SetName(name *string) {
	o.Name = name
}

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

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

	if o.Endpoint != nil {

		// query param endpoint
		var qrEndpoint string

		if o.Endpoint != nil {
			qrEndpoint = *o.Endpoint
		}
		qEndpoint := qrEndpoint
		if qEndpoint != "" {

			if err := r.SetQueryParam("endpoint", qEndpoint); 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 len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
