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

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

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

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

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

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

	for the notify read repo list operation.

	Typically these are written to a http.Request.
*/
type NotifyReadRepoListParams 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

	/* Owner.

	   owner of the repo
	*/
	Owner string

	/* Repo.

	   name of the repo
	*/
	Repo string

	/* 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 repo list params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *NotifyReadRepoListParams) WithDefaults() *NotifyReadRepoListParams {
	o.SetDefaults()
	return o
}

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

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

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

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

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

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

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

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

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

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

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

// WithOwner adds the owner to the notify read repo list params
func (o *NotifyReadRepoListParams) WithOwner(owner string) *NotifyReadRepoListParams {
	o.SetOwner(owner)
	return o
}

// SetOwner adds the owner to the notify read repo list params
func (o *NotifyReadRepoListParams) SetOwner(owner string) {
	o.Owner = owner
}

// WithRepo adds the repo to the notify read repo list params
func (o *NotifyReadRepoListParams) WithRepo(repo string) *NotifyReadRepoListParams {
	o.SetRepo(repo)
	return o
}

// SetRepo adds the repo to the notify read repo list params
func (o *NotifyReadRepoListParams) SetRepo(repo string) {
	o.Repo = repo
}

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

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

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

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

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

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

	// path param repo
	if err := r.SetPathParam("repo", o.Repo); 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
}

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