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

package accounts

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

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

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

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

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

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

	for the account relationships operation.

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

	/* ID.

	   Account IDs.
	*/
	ID []string

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

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

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

// WithTimeout adds the timeout to the account relationships params
func (o *AccountRelationshipsParams) WithTimeout(timeout time.Duration) *AccountRelationshipsParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the account relationships params
func (o *AccountRelationshipsParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the account relationships params
func (o *AccountRelationshipsParams) WithContext(ctx context.Context) *AccountRelationshipsParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the account relationships params
func (o *AccountRelationshipsParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the account relationships params
func (o *AccountRelationshipsParams) WithHTTPClient(client *http.Client) *AccountRelationshipsParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the account relationships params
func (o *AccountRelationshipsParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithID adds the id to the account relationships params
func (o *AccountRelationshipsParams) WithID(id []string) *AccountRelationshipsParams {
	o.SetID(id)
	return o
}

// SetID adds the id to the account relationships params
func (o *AccountRelationshipsParams) SetID(id []string) {
	o.ID = id
}

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

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

	if o.ID != nil {

		// binding items for id[]
		joinedID := o.bindParamID(reg)

		// query array param id[]
		if err := r.SetQueryParam("id[]", joinedID...); err != nil {
			return err
		}
	}

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

// bindParamAccountRelationships binds the parameter id[]
func (o *AccountRelationshipsParams) bindParamID(formats strfmt.Registry) []string {
	iDIR := o.ID

	var iDIC []string
	for _, iDIIR := range iDIR { // explode []string

		iDIIV := iDIIR // string as string
		iDIC = append(iDIC, iDIIV)
	}

	// items.CollectionFormat: "multi"
	iDIS := swag.JoinByFormat(iDIC, "multi")

	return iDIS
}
