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

package admin

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

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

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

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

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

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

	for the emoji create operation.

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

	/* Category.

	   Category in which to place the new emoji. If left blank, emoji will be uncategorized. If a category with the given name doesn't exist yet, it will be created.
	*/
	Category *string

	/* Image.

	   A png or gif image of the emoji. Animated pngs work too! To ensure compatibility with other fedi implementations, emoji size limit is 50kb by default.
	*/
	Image runtime.NamedReadCloser

	/* Shortcode.

	   The code to use for the emoji, which will be used by instance denizens to select it. This must be unique on the instance.
	*/
	Shortcode string

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

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

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

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

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

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

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

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

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

// WithCategory adds the category to the emoji create params
func (o *EmojiCreateParams) WithCategory(category *string) *EmojiCreateParams {
	o.SetCategory(category)
	return o
}

// SetCategory adds the category to the emoji create params
func (o *EmojiCreateParams) SetCategory(category *string) {
	o.Category = category
}

// WithImage adds the image to the emoji create params
func (o *EmojiCreateParams) WithImage(image runtime.NamedReadCloser) *EmojiCreateParams {
	o.SetImage(image)
	return o
}

// SetImage adds the image to the emoji create params
func (o *EmojiCreateParams) SetImage(image runtime.NamedReadCloser) {
	o.Image = image
}

// WithShortcode adds the shortcode to the emoji create params
func (o *EmojiCreateParams) WithShortcode(shortcode string) *EmojiCreateParams {
	o.SetShortcode(shortcode)
	return o
}

// SetShortcode adds the shortcode to the emoji create params
func (o *EmojiCreateParams) SetShortcode(shortcode string) {
	o.Shortcode = shortcode
}

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

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

	if o.Category != nil {

		// form param category
		var frCategory string
		if o.Category != nil {
			frCategory = *o.Category
		}
		fCategory := frCategory
		if fCategory != "" {
			if err := r.SetFormParam("category", fCategory); err != nil {
				return err
			}
		}
	}
	// form file param image
	if err := r.SetFileParam("image", o.Image); err != nil {
		return err
	}

	// form param shortcode
	frShortcode := o.Shortcode
	fShortcode := frShortcode
	if fShortcode != "" {
		if err := r.SetFormParam("shortcode", fShortcode); err != nil {
			return err
		}
	}

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