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

package user

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

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

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

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

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

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

	for the user current tracked times operation.

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

	/* Before.

	   Only show times 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 times updated after the given time. This is a timestamp in RFC 3339 format

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

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

// WithDefaults hydrates default values in the user current tracked times params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UserCurrentTrackedTimesParams) WithDefaults() *UserCurrentTrackedTimesParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the user current tracked times params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UserCurrentTrackedTimesParams) SetDefaults() {
	// no default values defined for this parameter
}

// WithTimeout adds the timeout to the user current tracked times params
func (o *UserCurrentTrackedTimesParams) WithTimeout(timeout time.Duration) *UserCurrentTrackedTimesParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the user current tracked times params
func (o *UserCurrentTrackedTimesParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the user current tracked times params
func (o *UserCurrentTrackedTimesParams) WithContext(ctx context.Context) *UserCurrentTrackedTimesParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the user current tracked times params
func (o *UserCurrentTrackedTimesParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the user current tracked times params
func (o *UserCurrentTrackedTimesParams) WithHTTPClient(client *http.Client) *UserCurrentTrackedTimesParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the user current tracked times params
func (o *UserCurrentTrackedTimesParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithBefore adds the before to the user current tracked times params
func (o *UserCurrentTrackedTimesParams) WithBefore(before *strfmt.DateTime) *UserCurrentTrackedTimesParams {
	o.SetBefore(before)
	return o
}

// SetBefore adds the before to the user current tracked times params
func (o *UserCurrentTrackedTimesParams) SetBefore(before *strfmt.DateTime) {
	o.Before = before
}

// WithLimit adds the limit to the user current tracked times params
func (o *UserCurrentTrackedTimesParams) WithLimit(limit *int64) *UserCurrentTrackedTimesParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the user current tracked times params
func (o *UserCurrentTrackedTimesParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithPage adds the page to the user current tracked times params
func (o *UserCurrentTrackedTimesParams) WithPage(page *int64) *UserCurrentTrackedTimesParams {
	o.SetPage(page)
	return o
}

// SetPage adds the page to the user current tracked times params
func (o *UserCurrentTrackedTimesParams) SetPage(page *int64) {
	o.Page = page
}

// WithSince adds the since to the user current tracked times params
func (o *UserCurrentTrackedTimesParams) WithSince(since *strfmt.DateTime) *UserCurrentTrackedTimesParams {
	o.SetSince(since)
	return o
}

// SetSince adds the since to the user current tracked times params
func (o *UserCurrentTrackedTimesParams) SetSince(since *strfmt.DateTime) {
	o.Since = since
}

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

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

	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 len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
