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

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

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

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

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

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

	for the account search get operation.

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

	/* Following.

	   Show only accounts that the requesting account follows. If this is set to `true`, then the GoToSocial instance will enhance the search by also searching within account notes, not just in usernames and display names.
	*/
	Following *bool

	/* Limit.

	   Number of results to try to return.

	   Default: 40
	*/
	Limit *int64

	/* Offset.

	   Page number of results to return (starts at 0). This parameter is currently not used, offsets over 0 will always return 0 results.
	*/
	Offset *int64

	/* Q.

	     Query string to search for. This can be in the following forms:
	- `@[username]` -- search for an account with the given username on any domain. Can return multiple results.
	- `@[username]@[domain]` -- search for a remote account with exact username and domain. Will only ever return 1 result at most.
	- any arbitrary string -- search for accounts containing the given string in their username or display name. Can return multiple results.
	*/
	Q string

	/* Resolve.

	   If query is for `@[username]@[domain]`, or a URL, allow the GoToSocial instance to resolve the search by making calls to remote instances (webfinger, ActivityPub, etc).
	*/
	Resolve *bool

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

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

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

		limitDefault = int64(40)

		offsetDefault = int64(0)

		resolveDefault = bool(false)
	)

	val := AccountSearchGetParams{
		Following: &followingDefault,
		Limit:     &limitDefault,
		Offset:    &offsetDefault,
		Resolve:   &resolveDefault,
	}

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

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

// SetTimeout adds the timeout to the account search get params
func (o *AccountSearchGetParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

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

// SetContext adds the context to the account search get params
func (o *AccountSearchGetParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

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

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

// WithFollowing adds the following to the account search get params
func (o *AccountSearchGetParams) WithFollowing(following *bool) *AccountSearchGetParams {
	o.SetFollowing(following)
	return o
}

// SetFollowing adds the following to the account search get params
func (o *AccountSearchGetParams) SetFollowing(following *bool) {
	o.Following = following
}

// WithLimit adds the limit to the account search get params
func (o *AccountSearchGetParams) WithLimit(limit *int64) *AccountSearchGetParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the account search get params
func (o *AccountSearchGetParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithOffset adds the offset to the account search get params
func (o *AccountSearchGetParams) WithOffset(offset *int64) *AccountSearchGetParams {
	o.SetOffset(offset)
	return o
}

// SetOffset adds the offset to the account search get params
func (o *AccountSearchGetParams) SetOffset(offset *int64) {
	o.Offset = offset
}

// WithQ adds the q to the account search get params
func (o *AccountSearchGetParams) WithQ(q string) *AccountSearchGetParams {
	o.SetQ(q)
	return o
}

// SetQ adds the q to the account search get params
func (o *AccountSearchGetParams) SetQ(q string) {
	o.Q = q
}

// WithResolve adds the resolve to the account search get params
func (o *AccountSearchGetParams) WithResolve(resolve *bool) *AccountSearchGetParams {
	o.SetResolve(resolve)
	return o
}

// SetResolve adds the resolve to the account search get params
func (o *AccountSearchGetParams) SetResolve(resolve *bool) {
	o.Resolve = resolve
}

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

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

	if o.Following != nil {

		// query param following
		var qrFollowing bool

		if o.Following != nil {
			qrFollowing = *o.Following
		}
		qFollowing := swag.FormatBool(qrFollowing)
		if qFollowing != "" {

			if err := r.SetQueryParam("following", qFollowing); err != nil {
				return err
			}
		}
	}

	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
			}
		}
	}

	// query param q
	qrQ := o.Q
	qQ := qrQ
	if qQ != "" {

		if err := r.SetQueryParam("q", qQ); err != nil {
			return err
		}
	}

	if o.Resolve != nil {

		// query param resolve
		var qrResolve bool

		if o.Resolve != nil {
			qrResolve = *o.Resolve
		}
		qResolve := swag.FormatBool(qrResolve)
		if qResolve != "" {

			if err := r.SetQueryParam("resolve", qResolve); err != nil {
				return err
			}
		}
	}

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