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

package application_service

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

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

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

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

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

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

	for the application service list operation.

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

	/* Limit.

	     Max number of applications to return in the result-set.
	If not set, it will be treated as 0, and the response will only return the total_count.

	     Format: int64
	*/
	Limit *int64

	/* Offset.

	   Offset in the result-set (for pagination).

	   Format: int64
	*/
	Offset *int64

	/* Search.

	   If set, the given string will be used to search on name (optional).
	*/
	Search *string

	/* TenantID.

	   Tenant ID to list the applications for.
	*/
	TenantID *string

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

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

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

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

// SetTimeout adds the timeout to the application service list params
func (o *ApplicationServiceListParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

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

// SetContext adds the context to the application service list params
func (o *ApplicationServiceListParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

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

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

// WithLimit adds the limit to the application service list params
func (o *ApplicationServiceListParams) WithLimit(limit *int64) *ApplicationServiceListParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the application service list params
func (o *ApplicationServiceListParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithOffset adds the offset to the application service list params
func (o *ApplicationServiceListParams) WithOffset(offset *int64) *ApplicationServiceListParams {
	o.SetOffset(offset)
	return o
}

// SetOffset adds the offset to the application service list params
func (o *ApplicationServiceListParams) SetOffset(offset *int64) {
	o.Offset = offset
}

// WithSearch adds the search to the application service list params
func (o *ApplicationServiceListParams) WithSearch(search *string) *ApplicationServiceListParams {
	o.SetSearch(search)
	return o
}

// SetSearch adds the search to the application service list params
func (o *ApplicationServiceListParams) SetSearch(search *string) {
	o.Search = search
}

// WithTenantID adds the tenantID to the application service list params
func (o *ApplicationServiceListParams) WithTenantID(tenantID *string) *ApplicationServiceListParams {
	o.SetTenantID(tenantID)
	return o
}

// SetTenantID adds the tenantId to the application service list params
func (o *ApplicationServiceListParams) SetTenantID(tenantID *string) {
	o.TenantID = tenantID
}

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

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

	if o.Limit != nil {

		// query param limit
		var qrLimit int64

		if o.Limit != nil {
			qrLimit = *o.Limit
		}
		qLimit := swag.FormatInt64(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 := swag.FormatInt64(qrOffset)
		if qOffset != "" {

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

	if o.Search != nil {

		// query param search
		var qrSearch string

		if o.Search != nil {
			qrSearch = *o.Search
		}
		qSearch := qrSearch
		if qSearch != "" {

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

	if o.TenantID != nil {

		// query param tenantId
		var qrTenantID string

		if o.TenantID != nil {
			qrTenantID = *o.TenantID
		}
		qTenantID := qrTenantID
		if qTenantID != "" {

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

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