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

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

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

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

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

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

	for the notify read list operation.

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

	/* All.

	   If true, mark all notifications on this repo. Default value is false
	*/
	All *string

	/* LastReadAt.

	   Describes the last point that notifications were checked. Anything updated since this time will not be updated.

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

	/* StatusTypes.

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

	/* ToStatus.

	   Status to mark notifications as, Defaults to read.
	*/
	ToStatus *string

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

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

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

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

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

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

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

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

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

// WithAll adds the all to the notify read list params
func (o *NotifyReadListParams) WithAll(all *string) *NotifyReadListParams {
	o.SetAll(all)
	return o
}

// SetAll adds the all to the notify read list params
func (o *NotifyReadListParams) SetAll(all *string) {
	o.All = all
}

// WithLastReadAt adds the lastReadAt to the notify read list params
func (o *NotifyReadListParams) WithLastReadAt(lastReadAt *strfmt.DateTime) *NotifyReadListParams {
	o.SetLastReadAt(lastReadAt)
	return o
}

// SetLastReadAt adds the lastReadAt to the notify read list params
func (o *NotifyReadListParams) SetLastReadAt(lastReadAt *strfmt.DateTime) {
	o.LastReadAt = lastReadAt
}

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

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

// WithToStatus adds the toStatus to the notify read list params
func (o *NotifyReadListParams) WithToStatus(toStatus *string) *NotifyReadListParams {
	o.SetToStatus(toStatus)
	return o
}

// SetToStatus adds the toStatus to the notify read list params
func (o *NotifyReadListParams) SetToStatus(toStatus *string) {
	o.ToStatus = toStatus
}

// WriteToRequest writes these params to a swagger request
func (o *NotifyReadListParams) 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 string

		if o.All != nil {
			qrAll = *o.All
		}
		qAll := qrAll
		if qAll != "" {

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

	if o.LastReadAt != nil {

		// query param last_read_at
		var qrLastReadAt strfmt.DateTime

		if o.LastReadAt != nil {
			qrLastReadAt = *o.LastReadAt
		}
		qLastReadAt := qrLastReadAt.String()
		if qLastReadAt != "" {

			if err := r.SetQueryParam("last_read_at", qLastReadAt); 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.ToStatus != nil {

		// query param to-status
		var qrToStatus string

		if o.ToStatus != nil {
			qrToStatus = *o.ToStatus
		}
		qToStatus := qrToStatus
		if qToStatus != "" {

			if err := r.SetQueryParam("to-status", qToStatus); err != nil {
				return err
			}
		}
	}

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

// bindParamNotifyReadList binds the parameter status-types
func (o *NotifyReadListParams) 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
}
