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

package credit_management

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

// NewDecreaseCreditParams creates a new DecreaseCreditParams object
// with the default values initialized.
func NewDecreaseCreditParams() *DecreaseCreditParams {
	var ()
	return &DecreaseCreditParams{

		timeout: cr.DefaultTimeout,
	}
}

// NewDecreaseCreditParamsWithTimeout creates a new DecreaseCreditParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewDecreaseCreditParamsWithTimeout(timeout time.Duration) *DecreaseCreditParams {
	var ()
	return &DecreaseCreditParams{

		timeout: timeout,
	}
}

// NewDecreaseCreditParamsWithContext creates a new DecreaseCreditParams object
// with the default values initialized, and the ability to set a context for a request
func NewDecreaseCreditParamsWithContext(ctx context.Context) *DecreaseCreditParams {
	var ()
	return &DecreaseCreditParams{

		Context: ctx,
	}
}

// NewDecreaseCreditParamsWithHTTPClient creates a new DecreaseCreditParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewDecreaseCreditParamsWithHTTPClient(client *http.Client) *DecreaseCreditParams {
	var ()
	return &DecreaseCreditParams{
		HTTPClient: client,
	}
}

/*DecreaseCreditParams contains all the parameters to send to the API endpoint
for the decrease credit operation typically these are written to a http.Request
*/
type DecreaseCreditParams struct {

	/*Amount
	  Amount to be decreased

	*/
	Amount float64
	/*ID
	  Id of the account to be checked

	*/
	ID string
	/*Medium
	  Medium (cash/credit) to be used in the accounting

	*/
	Medium string

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

// WithTimeout adds the timeout to the decrease credit params
func (o *DecreaseCreditParams) WithTimeout(timeout time.Duration) *DecreaseCreditParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the decrease credit params
func (o *DecreaseCreditParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the decrease credit params
func (o *DecreaseCreditParams) WithContext(ctx context.Context) *DecreaseCreditParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the decrease credit params
func (o *DecreaseCreditParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the decrease credit params
func (o *DecreaseCreditParams) WithHTTPClient(client *http.Client) *DecreaseCreditParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the decrease credit params
func (o *DecreaseCreditParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithAmount adds the amount to the decrease credit params
func (o *DecreaseCreditParams) WithAmount(amount float64) *DecreaseCreditParams {
	o.SetAmount(amount)
	return o
}

// SetAmount adds the amount to the decrease credit params
func (o *DecreaseCreditParams) SetAmount(amount float64) {
	o.Amount = amount
}

// WithID adds the id to the decrease credit params
func (o *DecreaseCreditParams) WithID(id string) *DecreaseCreditParams {
	o.SetID(id)
	return o
}

// SetID adds the id to the decrease credit params
func (o *DecreaseCreditParams) SetID(id string) {
	o.ID = id
}

// WithMedium adds the medium to the decrease credit params
func (o *DecreaseCreditParams) WithMedium(medium string) *DecreaseCreditParams {
	o.SetMedium(medium)
	return o
}

// SetMedium adds the medium to the decrease credit params
func (o *DecreaseCreditParams) SetMedium(medium string) {
	o.Medium = medium
}

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

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

	// query param amount
	qrAmount := o.Amount
	qAmount := swag.FormatFloat64(qrAmount)
	if qAmount != "" {
		if err := r.SetQueryParam("amount", qAmount); err != nil {
			return err
		}
	}

	// path param id
	if err := r.SetPathParam("id", o.ID); err != nil {
		return err
	}

	// path param medium
	if err := r.SetPathParam("medium", o.Medium); err != nil {
		return err
	}

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