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

package blocks

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

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

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

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

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

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

	for the blocks get operation.

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

	/* Limit.

	   Number of blocked accounts to return.

	   Default: 40
	*/
	Limit *int64

	/* MaxID.

	   Return only blocked accounts *OLDER* than the given max ID. The blocked account with the specified ID will not be included in the response. NOTE: the ID is of the internal block, NOT any of the returned accounts.
	*/
	MaxID *string

	/* MinID.

	   Return only blocked accounts *IMMEDIATELY NEWER* than the given min ID. The blocked account with the specified ID will not be included in the response. NOTE: the ID is of the internal block, NOT any of the returned accounts.
	*/
	MinID *string

	/* SinceID.

	   Return only blocked accounts *NEWER* than the given since ID. The blocked account with the specified ID will not be included in the response. NOTE: the ID is of the internal block, NOT any of the returned accounts.
	*/
	SinceID *string

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

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

// SetDefaults hydrates default values in the blocks get params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *BlocksGetParams) SetDefaults() {
	var (
		limitDefault = int64(40)
	)

	val := BlocksGetParams{
		Limit: &limitDefault,
	}

	val.timeout = o.timeout
	val.Context = o.Context
	val.HTTPClient = o.HTTPClient
	*o = val
}

// WithTimeout adds the timeout to the blocks get params
func (o *BlocksGetParams) WithTimeout(timeout time.Duration) *BlocksGetParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the blocks get params
func (o *BlocksGetParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the blocks get params
func (o *BlocksGetParams) WithContext(ctx context.Context) *BlocksGetParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the blocks get params
func (o *BlocksGetParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the blocks get params
func (o *BlocksGetParams) WithHTTPClient(client *http.Client) *BlocksGetParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the blocks get params
func (o *BlocksGetParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithLimit adds the limit to the blocks get params
func (o *BlocksGetParams) WithLimit(limit *int64) *BlocksGetParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the blocks get params
func (o *BlocksGetParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithMaxID adds the maxID to the blocks get params
func (o *BlocksGetParams) WithMaxID(maxID *string) *BlocksGetParams {
	o.SetMaxID(maxID)
	return o
}

// SetMaxID adds the maxId to the blocks get params
func (o *BlocksGetParams) SetMaxID(maxID *string) {
	o.MaxID = maxID
}

// WithMinID adds the minID to the blocks get params
func (o *BlocksGetParams) WithMinID(minID *string) *BlocksGetParams {
	o.SetMinID(minID)
	return o
}

// SetMinID adds the minId to the blocks get params
func (o *BlocksGetParams) SetMinID(minID *string) {
	o.MinID = minID
}

// WithSinceID adds the sinceID to the blocks get params
func (o *BlocksGetParams) WithSinceID(sinceID *string) *BlocksGetParams {
	o.SetSinceID(sinceID)
	return o
}

// SetSinceID adds the sinceId to the blocks get params
func (o *BlocksGetParams) SetSinceID(sinceID *string) {
	o.SinceID = sinceID
}

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

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

	if o.Limit != nil {

		// query param limit
		var qrLimit int64

		if o.Limit != nil {
			qrLimit = *o.Limit
		}
		qLimit := swag.FormatInt64(qrLimit)
		if qLimit != "" {

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

	if o.MaxID != nil {

		// query param max_id
		var qrMaxID string

		if o.MaxID != nil {
			qrMaxID = *o.MaxID
		}
		qMaxID := qrMaxID
		if qMaxID != "" {

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

	if o.MinID != nil {

		// query param min_id
		var qrMinID string

		if o.MinID != nil {
			qrMinID = *o.MinID
		}
		qMinID := qrMinID
		if qMinID != "" {

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

	if o.SinceID != nil {

		// query param since_id
		var qrSinceID string

		if o.SinceID != nil {
			qrSinceID = *o.SinceID
		}
		qSinceID := qrSinceID
		if qSinceID != "" {

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

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