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

package gateway_service

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

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

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

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

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

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

	for the gateway service get metrics operation.

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

	/* Aggregation.

	    Aggregation.

	- HOUR: Hour.
	- DAY: Day.
	- MONTH: Month.
	- MINUTE: Minute.

	    Default: "HOUR"
	*/
	Aggregation *string

	/* End.

	   Interval end timestamp.

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

	/* GatewayID.

	   Gateway ID (EUI64).
	*/
	GatewayID string

	/* Start.

	   Interval start timestamp.

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

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

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

// SetDefaults hydrates default values in the gateway service get metrics params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GatewayServiceGetMetricsParams) SetDefaults() {
	var (
		aggregationDefault = string("HOUR")
	)

	val := GatewayServiceGetMetricsParams{
		Aggregation: &aggregationDefault,
	}

	val.timeout = o.timeout
	val.Context = o.Context
	val.HTTPClient = o.HTTPClient
	*o = val
}

// WithTimeout adds the timeout to the gateway service get metrics params
func (o *GatewayServiceGetMetricsParams) WithTimeout(timeout time.Duration) *GatewayServiceGetMetricsParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the gateway service get metrics params
func (o *GatewayServiceGetMetricsParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the gateway service get metrics params
func (o *GatewayServiceGetMetricsParams) WithContext(ctx context.Context) *GatewayServiceGetMetricsParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the gateway service get metrics params
func (o *GatewayServiceGetMetricsParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the gateway service get metrics params
func (o *GatewayServiceGetMetricsParams) WithHTTPClient(client *http.Client) *GatewayServiceGetMetricsParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the gateway service get metrics params
func (o *GatewayServiceGetMetricsParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithAggregation adds the aggregation to the gateway service get metrics params
func (o *GatewayServiceGetMetricsParams) WithAggregation(aggregation *string) *GatewayServiceGetMetricsParams {
	o.SetAggregation(aggregation)
	return o
}

// SetAggregation adds the aggregation to the gateway service get metrics params
func (o *GatewayServiceGetMetricsParams) SetAggregation(aggregation *string) {
	o.Aggregation = aggregation
}

// WithEnd adds the end to the gateway service get metrics params
func (o *GatewayServiceGetMetricsParams) WithEnd(end *strfmt.DateTime) *GatewayServiceGetMetricsParams {
	o.SetEnd(end)
	return o
}

// SetEnd adds the end to the gateway service get metrics params
func (o *GatewayServiceGetMetricsParams) SetEnd(end *strfmt.DateTime) {
	o.End = end
}

// WithGatewayID adds the gatewayID to the gateway service get metrics params
func (o *GatewayServiceGetMetricsParams) WithGatewayID(gatewayID string) *GatewayServiceGetMetricsParams {
	o.SetGatewayID(gatewayID)
	return o
}

// SetGatewayID adds the gatewayId to the gateway service get metrics params
func (o *GatewayServiceGetMetricsParams) SetGatewayID(gatewayID string) {
	o.GatewayID = gatewayID
}

// WithStart adds the start to the gateway service get metrics params
func (o *GatewayServiceGetMetricsParams) WithStart(start *strfmt.DateTime) *GatewayServiceGetMetricsParams {
	o.SetStart(start)
	return o
}

// SetStart adds the start to the gateway service get metrics params
func (o *GatewayServiceGetMetricsParams) SetStart(start *strfmt.DateTime) {
	o.Start = start
}

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

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

	if o.Aggregation != nil {

		// query param aggregation
		var qrAggregation string

		if o.Aggregation != nil {
			qrAggregation = *o.Aggregation
		}
		qAggregation := qrAggregation
		if qAggregation != "" {

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

	if o.End != nil {

		// query param end
		var qrEnd strfmt.DateTime

		if o.End != nil {
			qrEnd = *o.End
		}
		qEnd := qrEnd.String()
		if qEnd != "" {

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

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

	if o.Start != nil {

		// query param start
		var qrStart strfmt.DateTime

		if o.Start != nil {
			qrStart = *o.Start
		}
		qStart := qrStart.String()
		if qStart != "" {

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

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