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

package admin

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

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

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

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

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

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

	for the rule create operation.

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

	/* Text.

	   Text body for the instance rule, plaintext.
	*/
	Text string

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

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

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

// WithTimeout adds the timeout to the rule create params
func (o *RuleCreateParams) WithTimeout(timeout time.Duration) *RuleCreateParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the rule create params
func (o *RuleCreateParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the rule create params
func (o *RuleCreateParams) WithContext(ctx context.Context) *RuleCreateParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the rule create params
func (o *RuleCreateParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the rule create params
func (o *RuleCreateParams) WithHTTPClient(client *http.Client) *RuleCreateParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the rule create params
func (o *RuleCreateParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithText adds the text to the rule create params
func (o *RuleCreateParams) WithText(text string) *RuleCreateParams {
	o.SetText(text)
	return o
}

// SetText adds the text to the rule create params
func (o *RuleCreateParams) SetText(text string) {
	o.Text = text
}

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

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

	// form param text
	frText := o.Text
	fText := frText
	if fText != "" {
		if err := r.SetFormParam("text", fText); err != nil {
			return err
		}
	}

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