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

package accounts

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

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

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

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

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

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

	for the account follow operation.

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

	/* ID.

	   ID of the account to follow.
	*/
	ID string

	/* Notify.

	   Notify when this account posts.
	*/
	Notify *bool

	/* Reblogs.

	   Show reblogs from this account.

	   Default: true
	*/
	Reblogs *bool

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

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

// SetDefaults hydrates default values in the account follow params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *AccountFollowParams) SetDefaults() {
	var (
		notifyDefault = bool(false)

		reblogsDefault = bool(true)
	)

	val := AccountFollowParams{
		Notify:  &notifyDefault,
		Reblogs: &reblogsDefault,
	}

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

// WithTimeout adds the timeout to the account follow params
func (o *AccountFollowParams) WithTimeout(timeout time.Duration) *AccountFollowParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the account follow params
func (o *AccountFollowParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the account follow params
func (o *AccountFollowParams) WithContext(ctx context.Context) *AccountFollowParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the account follow params
func (o *AccountFollowParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the account follow params
func (o *AccountFollowParams) WithHTTPClient(client *http.Client) *AccountFollowParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the account follow params
func (o *AccountFollowParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithID adds the id to the account follow params
func (o *AccountFollowParams) WithID(id string) *AccountFollowParams {
	o.SetID(id)
	return o
}

// SetID adds the id to the account follow params
func (o *AccountFollowParams) SetID(id string) {
	o.ID = id
}

// WithNotify adds the notify to the account follow params
func (o *AccountFollowParams) WithNotify(notify *bool) *AccountFollowParams {
	o.SetNotify(notify)
	return o
}

// SetNotify adds the notify to the account follow params
func (o *AccountFollowParams) SetNotify(notify *bool) {
	o.Notify = notify
}

// WithReblogs adds the reblogs to the account follow params
func (o *AccountFollowParams) WithReblogs(reblogs *bool) *AccountFollowParams {
	o.SetReblogs(reblogs)
	return o
}

// SetReblogs adds the reblogs to the account follow params
func (o *AccountFollowParams) SetReblogs(reblogs *bool) {
	o.Reblogs = reblogs
}

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

	if o.Notify != nil {

		// form param notify
		var frNotify bool
		if o.Notify != nil {
			frNotify = *o.Notify
		}
		fNotify := swag.FormatBool(frNotify)
		if fNotify != "" {
			if err := r.SetFormParam("notify", fNotify); err != nil {
				return err
			}
		}
	}

	if o.Reblogs != nil {

		// form param reblogs
		var frReblogs bool
		if o.Reblogs != nil {
			frReblogs = *o.Reblogs
		}
		fReblogs := swag.FormatBool(frReblogs)
		if fReblogs != "" {
			if err := r.SetFormParam("reblogs", fReblogs); err != nil {
				return err
			}
		}
	}

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