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

package event_management

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

// NewListStatesParams creates a new ListStatesParams object
// with the default values initialized.
func NewListStatesParams() *ListStatesParams {
	var ()
	return &ListStatesParams{

		timeout: cr.DefaultTimeout,
	}
}

// NewListStatesParamsWithTimeout creates a new ListStatesParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewListStatesParamsWithTimeout(timeout time.Duration) *ListStatesParams {
	var ()
	return &ListStatesParams{

		timeout: timeout,
	}
}

// NewListStatesParamsWithContext creates a new ListStatesParams object
// with the default values initialized, and the ability to set a context for a request
func NewListStatesParamsWithContext(ctx context.Context) *ListStatesParams {
	var ()
	return &ListStatesParams{

		Context: ctx,
	}
}

// NewListStatesParamsWithHTTPClient creates a new ListStatesParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewListStatesParamsWithHTTPClient(client *http.Client) *ListStatesParams {
	var ()
	return &ListStatesParams{
		HTTPClient: client,
	}
}

/*ListStatesParams contains all the parameters to send to the API endpoint
for the list states operation typically these are written to a http.Request
*/
type ListStatesParams struct {

	/*Region
	  Resource region to filter the usage

	*/
	Region *string
	/*Resource
	  Resource type to filter the usage

	*/
	Resource *string

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

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

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

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

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

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

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

// WithRegion adds the region to the list states params
func (o *ListStatesParams) WithRegion(region *string) *ListStatesParams {
	o.SetRegion(region)
	return o
}

// SetRegion adds the region to the list states params
func (o *ListStatesParams) SetRegion(region *string) {
	o.Region = region
}

// WithResource adds the resource to the list states params
func (o *ListStatesParams) WithResource(resource *string) *ListStatesParams {
	o.SetResource(resource)
	return o
}

// SetResource adds the resource to the list states params
func (o *ListStatesParams) SetResource(resource *string) {
	o.Resource = resource
}

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

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

	if o.Region != nil {

		// query param region
		var qrRegion string
		if o.Region != nil {
			qrRegion = *o.Region
		}
		qRegion := qrRegion
		if qRegion != "" {
			if err := r.SetQueryParam("region", qRegion); err != nil {
				return err
			}
		}

	}

	if o.Resource != nil {

		// query param resource
		var qrResource string
		if o.Resource != nil {
			qrResource = *o.Resource
		}
		qResource := qrResource
		if qResource != "" {
			if err := r.SetQueryParam("resource", qResource); err != nil {
				return err
			}
		}

	}

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