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

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

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

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

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

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

	for the media refetch operation.

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

	/* Domain.

	   Domain to refetch media from. If empty, all domains will be refetched.
	*/
	Domain *string

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

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

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

// WithTimeout adds the timeout to the media refetch params
func (o *MediaRefetchParams) WithTimeout(timeout time.Duration) *MediaRefetchParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the media refetch params
func (o *MediaRefetchParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the media refetch params
func (o *MediaRefetchParams) WithContext(ctx context.Context) *MediaRefetchParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the media refetch params
func (o *MediaRefetchParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the media refetch params
func (o *MediaRefetchParams) WithHTTPClient(client *http.Client) *MediaRefetchParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the media refetch params
func (o *MediaRefetchParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithDomain adds the domain to the media refetch params
func (o *MediaRefetchParams) WithDomain(domain *string) *MediaRefetchParams {
	o.SetDomain(domain)
	return o
}

// SetDomain adds the domain to the media refetch params
func (o *MediaRefetchParams) SetDomain(domain *string) {
	o.Domain = domain
}

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

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

	if o.Domain != nil {

		// query param domain
		var qrDomain string

		if o.Domain != nil {
			qrDomain = *o.Domain
		}
		qDomain := qrDomain
		if qDomain != "" {

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

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