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

package org_preferences

// 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/grafana/grafana-openapi-client-go/models"
)

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

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

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

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

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

	for the patch org preferences operation.

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

	// Body.
	Body *models.PatchPrefsCmd

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

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

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

// WithTimeout adds the timeout to the patch org preferences params
func (o *PatchOrgPreferencesParams) WithTimeout(timeout time.Duration) *PatchOrgPreferencesParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the patch org preferences params
func (o *PatchOrgPreferencesParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the patch org preferences params
func (o *PatchOrgPreferencesParams) WithContext(ctx context.Context) *PatchOrgPreferencesParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the patch org preferences params
func (o *PatchOrgPreferencesParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the patch org preferences params
func (o *PatchOrgPreferencesParams) WithHTTPClient(client *http.Client) *PatchOrgPreferencesParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the patch org preferences params
func (o *PatchOrgPreferencesParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithBody adds the body to the patch org preferences params
func (o *PatchOrgPreferencesParams) WithBody(body *models.PatchPrefsCmd) *PatchOrgPreferencesParams {
	o.SetBody(body)
	return o
}

// SetBody adds the body to the patch org preferences params
func (o *PatchOrgPreferencesParams) SetBody(body *models.PatchPrefsCmd) {
	o.Body = body
}

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

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

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