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

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

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

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

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

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

	for the account create operation.

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

	/* Agreement.

	   The user agrees to the terms, conditions, and policies of the instance.
	*/
	Agreement *bool

	/* Email.

	   The email address to be used for login.
	*/
	Email *string

	/* Locale.

	   The language of the confirmation email that will be sent.
	*/
	Locale *string

	/* Password.

	   The password to be used for login. This will be hashed before storage.
	*/
	Password *string

	/* Reason.

	   Text that will be reviewed by moderators if registrations require manual approval.
	*/
	Reason *string

	/* Username.

	   The desired username for the account.
	*/
	Username *string

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

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

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

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

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

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

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

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

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

// WithAgreement adds the agreement to the account create params
func (o *AccountCreateParams) WithAgreement(agreement *bool) *AccountCreateParams {
	o.SetAgreement(agreement)
	return o
}

// SetAgreement adds the agreement to the account create params
func (o *AccountCreateParams) SetAgreement(agreement *bool) {
	o.Agreement = agreement
}

// WithEmail adds the email to the account create params
func (o *AccountCreateParams) WithEmail(email *string) *AccountCreateParams {
	o.SetEmail(email)
	return o
}

// SetEmail adds the email to the account create params
func (o *AccountCreateParams) SetEmail(email *string) {
	o.Email = email
}

// WithLocale adds the locale to the account create params
func (o *AccountCreateParams) WithLocale(locale *string) *AccountCreateParams {
	o.SetLocale(locale)
	return o
}

// SetLocale adds the locale to the account create params
func (o *AccountCreateParams) SetLocale(locale *string) {
	o.Locale = locale
}

// WithPassword adds the password to the account create params
func (o *AccountCreateParams) WithPassword(password *string) *AccountCreateParams {
	o.SetPassword(password)
	return o
}

// SetPassword adds the password to the account create params
func (o *AccountCreateParams) SetPassword(password *string) {
	o.Password = password
}

// WithReason adds the reason to the account create params
func (o *AccountCreateParams) WithReason(reason *string) *AccountCreateParams {
	o.SetReason(reason)
	return o
}

// SetReason adds the reason to the account create params
func (o *AccountCreateParams) SetReason(reason *string) {
	o.Reason = reason
}

// WithUsername adds the username to the account create params
func (o *AccountCreateParams) WithUsername(username *string) *AccountCreateParams {
	o.SetUsername(username)
	return o
}

// SetUsername adds the username to the account create params
func (o *AccountCreateParams) SetUsername(username *string) {
	o.Username = username
}

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

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

	if o.Agreement != nil {

		// query param agreement
		var qrAgreement bool

		if o.Agreement != nil {
			qrAgreement = *o.Agreement
		}
		qAgreement := swag.FormatBool(qrAgreement)
		if qAgreement != "" {

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

	if o.Email != nil {

		// query param email
		var qrEmail string

		if o.Email != nil {
			qrEmail = *o.Email
		}
		qEmail := qrEmail
		if qEmail != "" {

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

	if o.Locale != nil {

		// query param locale
		var qrLocale string

		if o.Locale != nil {
			qrLocale = *o.Locale
		}
		qLocale := qrLocale
		if qLocale != "" {

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

	if o.Password != nil {

		// query param password
		var qrPassword string

		if o.Password != nil {
			qrPassword = *o.Password
		}
		qPassword := qrPassword
		if qPassword != "" {

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

	if o.Reason != nil {

		// query param reason
		var qrReason string

		if o.Reason != nil {
			qrReason = *o.Reason
		}
		qReason := qrReason
		if qReason != "" {

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

	if o.Username != nil {

		// query param username
		var qrUsername string

		if o.Username != nil {
			qrUsername = *o.Username
		}
		qUsername := qrUsername
		if qUsername != "" {

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

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