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

package bulk_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"
)

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

		timeout: cr.DefaultTimeout,
	}
}

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

		timeout: timeout,
	}
}

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

		Context: ctx,
	}
}

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

/*ListBillRunsByOrganizationParams contains all the parameters to send to the API endpoint
for the list bill runs by organization operation typically these are written to a http.Request
*/
type ListBillRunsByOrganizationParams struct {

	/*ID
	  Id of the billrun to be re-run.

	*/
	ID string
	/*Months
	  Amount of months to have in the report

	*/
	Months *int64

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

// WithTimeout adds the timeout to the list bill runs by organization params
func (o *ListBillRunsByOrganizationParams) WithTimeout(timeout time.Duration) *ListBillRunsByOrganizationParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the list bill runs by organization params
func (o *ListBillRunsByOrganizationParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the list bill runs by organization params
func (o *ListBillRunsByOrganizationParams) WithContext(ctx context.Context) *ListBillRunsByOrganizationParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the list bill runs by organization params
func (o *ListBillRunsByOrganizationParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the list bill runs by organization params
func (o *ListBillRunsByOrganizationParams) WithHTTPClient(client *http.Client) *ListBillRunsByOrganizationParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the list bill runs by organization params
func (o *ListBillRunsByOrganizationParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithID adds the id to the list bill runs by organization params
func (o *ListBillRunsByOrganizationParams) WithID(id string) *ListBillRunsByOrganizationParams {
	o.SetID(id)
	return o
}

// SetID adds the id to the list bill runs by organization params
func (o *ListBillRunsByOrganizationParams) SetID(id string) {
	o.ID = id
}

// WithMonths adds the months to the list bill runs by organization params
func (o *ListBillRunsByOrganizationParams) WithMonths(months *int64) *ListBillRunsByOrganizationParams {
	o.SetMonths(months)
	return o
}

// SetMonths adds the months to the list bill runs by organization params
func (o *ListBillRunsByOrganizationParams) SetMonths(months *int64) {
	o.Months = months
}

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

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

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

	if o.Months != nil {

		// query param months
		var qrMonths int64
		if o.Months != nil {
			qrMonths = *o.Months
		}
		qMonths := swag.FormatInt64(qrMonths)
		if qMonths != "" {
			if err := r.SetQueryParam("months", qMonths); err != nil {
				return err
			}
		}

	}

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