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

package notification

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

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

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

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

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

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

	for the notify get list operation.

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

	/* All.

	   If true, show notifications marked as read. Default value is false
	*/
	All *bool

	/* Before.

	   Only show notifications updated before the given time. This is a timestamp in RFC 3339 format

	   Format: date-time
	*/
	Before *strfmt.DateTime

	/* Limit.

	   page size of results
	*/
	Limit *int64

	/* Page.

	   page number of results to return (1-based)
	*/
	Page *int64

	/* Since.

	   Only show notifications updated after the given time. This is a timestamp in RFC 3339 format

	   Format: date-time
	*/
	Since *strfmt.DateTime

	/* StatusTypes.

	   Show notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread & pinned.
	*/
	StatusTypes []string

	/* SubjectType.

	   filter notifications by subject type
	*/
	SubjectType []string

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

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

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

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

// SetTimeout adds the timeout to the notify get list params
func (o *NotifyGetListParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

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

// SetContext adds the context to the notify get list params
func (o *NotifyGetListParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

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

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

// WithAll adds the all to the notify get list params
func (o *NotifyGetListParams) WithAll(all *bool) *NotifyGetListParams {
	o.SetAll(all)
	return o
}

// SetAll adds the all to the notify get list params
func (o *NotifyGetListParams) SetAll(all *bool) {
	o.All = all
}

// WithBefore adds the before to the notify get list params
func (o *NotifyGetListParams) WithBefore(before *strfmt.DateTime) *NotifyGetListParams {
	o.SetBefore(before)
	return o
}

// SetBefore adds the before to the notify get list params
func (o *NotifyGetListParams) SetBefore(before *strfmt.DateTime) {
	o.Before = before
}

// WithLimit adds the limit to the notify get list params
func (o *NotifyGetListParams) WithLimit(limit *int64) *NotifyGetListParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the notify get list params
func (o *NotifyGetListParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithPage adds the page to the notify get list params
func (o *NotifyGetListParams) WithPage(page *int64) *NotifyGetListParams {
	o.SetPage(page)
	return o
}

// SetPage adds the page to the notify get list params
func (o *NotifyGetListParams) SetPage(page *int64) {
	o.Page = page
}

// WithSince adds the since to the notify get list params
func (o *NotifyGetListParams) WithSince(since *strfmt.DateTime) *NotifyGetListParams {
	o.SetSince(since)
	return o
}

// SetSince adds the since to the notify get list params
func (o *NotifyGetListParams) SetSince(since *strfmt.DateTime) {
	o.Since = since
}

// WithStatusTypes adds the statusTypes to the notify get list params
func (o *NotifyGetListParams) WithStatusTypes(statusTypes []string) *NotifyGetListParams {
	o.SetStatusTypes(statusTypes)
	return o
}

// SetStatusTypes adds the statusTypes to the notify get list params
func (o *NotifyGetListParams) SetStatusTypes(statusTypes []string) {
	o.StatusTypes = statusTypes
}

// WithSubjectType adds the subjectType to the notify get list params
func (o *NotifyGetListParams) WithSubjectType(subjectType []string) *NotifyGetListParams {
	o.SetSubjectType(subjectType)
	return o
}

// SetSubjectType adds the subjectType to the notify get list params
func (o *NotifyGetListParams) SetSubjectType(subjectType []string) {
	o.SubjectType = subjectType
}

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

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

	if o.All != nil {

		// query param all
		var qrAll bool

		if o.All != nil {
			qrAll = *o.All
		}
		qAll := swag.FormatBool(qrAll)
		if qAll != "" {

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

	if o.Before != nil {

		// query param before
		var qrBefore strfmt.DateTime

		if o.Before != nil {
			qrBefore = *o.Before
		}
		qBefore := qrBefore.String()
		if qBefore != "" {

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

	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.Page != nil {

		// query param page
		var qrPage int64

		if o.Page != nil {
			qrPage = *o.Page
		}
		qPage := swag.FormatInt64(qrPage)
		if qPage != "" {

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

	if o.Since != nil {

		// query param since
		var qrSince strfmt.DateTime

		if o.Since != nil {
			qrSince = *o.Since
		}
		qSince := qrSince.String()
		if qSince != "" {

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

	if o.StatusTypes != nil {

		// binding items for status-types
		joinedStatusTypes := o.bindParamStatusTypes(reg)

		// query array param status-types
		if err := r.SetQueryParam("status-types", joinedStatusTypes...); err != nil {
			return err
		}
	}

	if o.SubjectType != nil {

		// binding items for subject-type
		joinedSubjectType := o.bindParamSubjectType(reg)

		// query array param subject-type
		if err := r.SetQueryParam("subject-type", joinedSubjectType...); err != nil {
			return err
		}
	}

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

// bindParamNotifyGetList binds the parameter status-types
func (o *NotifyGetListParams) bindParamStatusTypes(formats strfmt.Registry) []string {
	statusTypesIR := o.StatusTypes

	var statusTypesIC []string
	for _, statusTypesIIR := range statusTypesIR { // explode []string

		statusTypesIIV := statusTypesIIR // string as string
		statusTypesIC = append(statusTypesIC, statusTypesIIV)
	}

	// items.CollectionFormat: "multi"
	statusTypesIS := swag.JoinByFormat(statusTypesIC, "multi")

	return statusTypesIS
}

// bindParamNotifyGetList binds the parameter subject-type
func (o *NotifyGetListParams) bindParamSubjectType(formats strfmt.Registry) []string {
	subjectTypeIR := o.SubjectType

	var subjectTypeIC []string
	for _, subjectTypeIIR := range subjectTypeIR { // explode []string

		subjectTypeIIV := subjectTypeIIR // string as string
		subjectTypeIC = append(subjectTypeIC, subjectTypeIIV)
	}

	// items.CollectionFormat: "multi"
	subjectTypeIS := swag.JoinByFormat(subjectTypeIC, "multi")

	return subjectTypeIS
}
