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

package lists

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

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

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

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

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

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

	for the add list accounts operation.

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

	/* AccountIds.

	   Array of accountIDs to modify. Each accountID must correspond to an account that the requesting account follows.
	*/
	AccountIds []string

	/* ID.

	   ID of the list
	*/
	ID string

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

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

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

// WithTimeout adds the timeout to the add list accounts params
func (o *AddListAccountsParams) WithTimeout(timeout time.Duration) *AddListAccountsParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the add list accounts params
func (o *AddListAccountsParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the add list accounts params
func (o *AddListAccountsParams) WithContext(ctx context.Context) *AddListAccountsParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the add list accounts params
func (o *AddListAccountsParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the add list accounts params
func (o *AddListAccountsParams) WithHTTPClient(client *http.Client) *AddListAccountsParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the add list accounts params
func (o *AddListAccountsParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithAccountIds adds the accountIds to the add list accounts params
func (o *AddListAccountsParams) WithAccountIds(accountIds []string) *AddListAccountsParams {
	o.SetAccountIds(accountIds)
	return o
}

// SetAccountIds adds the accountIds to the add list accounts params
func (o *AddListAccountsParams) SetAccountIds(accountIds []string) {
	o.AccountIds = accountIds
}

// WithID adds the id to the add list accounts params
func (o *AddListAccountsParams) WithID(id string) *AddListAccountsParams {
	o.SetID(id)
	return o
}

// SetID adds the id to the add list accounts params
func (o *AddListAccountsParams) SetID(id string) {
	o.ID = id
}

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

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

	if o.AccountIds != nil {

		// binding items for account_ids[]
		joinedAccountIds := o.bindParamAccountIds(reg)

		// form array param account_ids[]
		if err := r.SetFormParam("account_ids[]", joinedAccountIds...); err != nil {
			return err
		}
	}

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

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

// bindParamAddListAccounts binds the parameter account_ids[]
func (o *AddListAccountsParams) bindParamAccountIds(formats strfmt.Registry) []string {
	accountIdsIR := o.AccountIds

	var accountIdsIC []string
	for _, accountIdsIIR := range accountIdsIR { // explode []string

		accountIdsIIV := accountIdsIIR // string as string
		accountIdsIC = append(accountIdsIC, accountIdsIIV)
	}

	// items.CollectionFormat: "multi"
	accountIdsIS := swag.JoinByFormat(accountIdsIC, "multi")

	return accountIdsIS
}
