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

package apps

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

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

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

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

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

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

	for the app create operation.

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

	/* ClientName.

	   The name of the application.
	*/
	ClientName string

	/* RedirectUris.

	     Where the user should be redirected after authorization.

	To display the authorization code to the user instead of redirecting to a web page, use `urn:ietf:wg:oauth:2.0:oob` in this parameter.
	*/
	RedirectURIs string

	/* Scopes.

	     Space separated list of scopes.

	If no scopes are provided, defaults to `read`.
	*/
	Scopes *string

	/* Website.

	   A URL to the web page of the app (optional).
	*/
	Website *string

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

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

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

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

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

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

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

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

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

// WithClientName adds the clientName to the app create params
func (o *AppCreateParams) WithClientName(clientName string) *AppCreateParams {
	o.SetClientName(clientName)
	return o
}

// SetClientName adds the clientName to the app create params
func (o *AppCreateParams) SetClientName(clientName string) {
	o.ClientName = clientName
}

// WithRedirectURIs adds the redirectUris to the app create params
func (o *AppCreateParams) WithRedirectURIs(redirectUris string) *AppCreateParams {
	o.SetRedirectURIs(redirectUris)
	return o
}

// SetRedirectURIs adds the redirectUris to the app create params
func (o *AppCreateParams) SetRedirectURIs(redirectUris string) {
	o.RedirectURIs = redirectUris
}

// WithScopes adds the scopes to the app create params
func (o *AppCreateParams) WithScopes(scopes *string) *AppCreateParams {
	o.SetScopes(scopes)
	return o
}

// SetScopes adds the scopes to the app create params
func (o *AppCreateParams) SetScopes(scopes *string) {
	o.Scopes = scopes
}

// WithWebsite adds the website to the app create params
func (o *AppCreateParams) WithWebsite(website *string) *AppCreateParams {
	o.SetWebsite(website)
	return o
}

// SetWebsite adds the website to the app create params
func (o *AppCreateParams) SetWebsite(website *string) {
	o.Website = website
}

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

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

	// form param client_name
	frClientName := o.ClientName
	fClientName := frClientName
	if fClientName != "" {
		if err := r.SetFormParam("client_name", fClientName); err != nil {
			return err
		}
	}

	// form param redirect_uris
	frRedirectUris := o.RedirectURIs
	fRedirectUris := frRedirectUris
	if fRedirectUris != "" {
		if err := r.SetFormParam("redirect_uris", fRedirectUris); err != nil {
			return err
		}
	}

	if o.Scopes != nil {

		// form param scopes
		var frScopes string
		if o.Scopes != nil {
			frScopes = *o.Scopes
		}
		fScopes := frScopes
		if fScopes != "" {
			if err := r.SetFormParam("scopes", fScopes); err != nil {
				return err
			}
		}
	}

	if o.Website != nil {

		// form param website
		var frWebsite string
		if o.Website != nil {
			frWebsite = *o.Website
		}
		fWebsite := frWebsite
		if fWebsite != "" {
			if err := r.SetFormParam("website", fWebsite); err != nil {
				return err
			}
		}
	}

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