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

package filters

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

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

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

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

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

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

	for the filter keyword post operation.

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

	/* ID.

	   ID of the filter to add the filtered status to.
	*/
	ID string

	/* Keyword.

	     The text to be filtered

	Sample: fnord
	*/
	Keyword string

	/* WholeWord.

	     Should the filter consider word boundaries?

	Sample: true
	*/
	WholeWord *bool

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

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

// SetDefaults hydrates default values in the filter keyword post params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *FilterKeywordPostParams) SetDefaults() {
	var (
		wholeWordDefault = bool(false)
	)

	val := FilterKeywordPostParams{
		WholeWord: &wholeWordDefault,
	}

	val.timeout = o.timeout
	val.Context = o.Context
	val.HTTPClient = o.HTTPClient
	*o = val
}

// WithTimeout adds the timeout to the filter keyword post params
func (o *FilterKeywordPostParams) WithTimeout(timeout time.Duration) *FilterKeywordPostParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the filter keyword post params
func (o *FilterKeywordPostParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the filter keyword post params
func (o *FilterKeywordPostParams) WithContext(ctx context.Context) *FilterKeywordPostParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the filter keyword post params
func (o *FilterKeywordPostParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the filter keyword post params
func (o *FilterKeywordPostParams) WithHTTPClient(client *http.Client) *FilterKeywordPostParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the filter keyword post params
func (o *FilterKeywordPostParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithID adds the id to the filter keyword post params
func (o *FilterKeywordPostParams) WithID(id string) *FilterKeywordPostParams {
	o.SetID(id)
	return o
}

// SetID adds the id to the filter keyword post params
func (o *FilterKeywordPostParams) SetID(id string) {
	o.ID = id
}

// WithKeyword adds the keyword to the filter keyword post params
func (o *FilterKeywordPostParams) WithKeyword(keyword string) *FilterKeywordPostParams {
	o.SetKeyword(keyword)
	return o
}

// SetKeyword adds the keyword to the filter keyword post params
func (o *FilterKeywordPostParams) SetKeyword(keyword string) {
	o.Keyword = keyword
}

// WithWholeWord adds the wholeWord to the filter keyword post params
func (o *FilterKeywordPostParams) WithWholeWord(wholeWord *bool) *FilterKeywordPostParams {
	o.SetWholeWord(wholeWord)
	return o
}

// SetWholeWord adds the wholeWord to the filter keyword post params
func (o *FilterKeywordPostParams) SetWholeWord(wholeWord *bool) {
	o.WholeWord = wholeWord
}

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

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

	// path param id
	if err := r.SetPathParam("id", o.ID); err != nil {
		return err
	}

	// form param keyword
	frKeyword := o.Keyword
	fKeyword := frKeyword
	if fKeyword != "" {
		if err := r.SetFormParam("keyword", fKeyword); err != nil {
			return err
		}
	}

	if o.WholeWord != nil {

		// form param whole_word
		var frWholeWord bool
		if o.WholeWord != nil {
			frWholeWord = *o.WholeWord
		}
		fWholeWord := swag.FormatBool(frWholeWord)
		if fWholeWord != "" {
			if err := r.SetFormParam("whole_word", fWholeWord); err != nil {
				return err
			}
		}
	}

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