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

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

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

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

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

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

	for the notify get repo list operation.

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

	/* Owner.

	   owner of the repo
	*/
	Owner string

	/* Page.

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

	/* Repo.

	   name of the repo
	*/
	Repo string

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// bindParamNotifyGetRepoList binds the parameter subject-type
func (o *NotifyGetRepoListParams) 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
}
