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

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

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

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

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

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

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

	for the device profile service list operation.

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

	/* Limit.

	     Max number of device-profiles 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.
	*/
	Search *string

	/* TenantID.

	   Tenant ID to list the device-profiles for.
	*/
	TenantID *string

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// WriteToRequest writes these params to a swagger request
func (o *DeviceProfileServiceListParams) 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
}
