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

package lm

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

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

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

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

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

/* GetDeviceInstanceGraphDataOnlyByInstanceIDParams contains all the parameters to send to the API endpoint
   for the get device instance graph data only by instance Id operation.

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

	// UserAgent.
	//
	// Default: "Logicmonitor/SDK: Argus Dist-v1.0.0-argus1"
	UserAgent *string

	// End.
	//
	// Format: int64
	End *int64

	// Format.
	Format *string

	// GraphID.
	//
	// Format: int32
	GraphID int32

	// InstanceID.
	//
	// Format: int32
	InstanceID int32

	// Start.
	//
	// Format: int64
	Start *int64

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

// WithDefaults hydrates default values in the get device instance graph data only by instance Id params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) WithDefaults() *GetDeviceInstanceGraphDataOnlyByInstanceIDParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the get device instance graph data only by instance Id params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) SetDefaults() {
	var (
		userAgentDefault = string("Logicmonitor/SDK: Argus Dist-v1.0.0-argus1")
	)

	val := GetDeviceInstanceGraphDataOnlyByInstanceIDParams{
		UserAgent: &userAgentDefault,
	}

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

// WithTimeout adds the timeout to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) WithTimeout(timeout time.Duration) *GetDeviceInstanceGraphDataOnlyByInstanceIDParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) WithContext(ctx context.Context) *GetDeviceInstanceGraphDataOnlyByInstanceIDParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) WithHTTPClient(client *http.Client) *GetDeviceInstanceGraphDataOnlyByInstanceIDParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithUserAgent adds the userAgent to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) WithUserAgent(userAgent *string) *GetDeviceInstanceGraphDataOnlyByInstanceIDParams {
	o.SetUserAgent(userAgent)
	return o
}

// SetUserAgent adds the userAgent to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) SetUserAgent(userAgent *string) {
	o.UserAgent = userAgent
}

// WithEnd adds the end to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) WithEnd(end *int64) *GetDeviceInstanceGraphDataOnlyByInstanceIDParams {
	o.SetEnd(end)
	return o
}

// SetEnd adds the end to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) SetEnd(end *int64) {
	o.End = end
}

// WithFormat adds the format to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) WithFormat(format *string) *GetDeviceInstanceGraphDataOnlyByInstanceIDParams {
	o.SetFormat(format)
	return o
}

// SetFormat adds the format to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) SetFormat(format *string) {
	o.Format = format
}

// WithGraphID adds the graphID to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) WithGraphID(graphID int32) *GetDeviceInstanceGraphDataOnlyByInstanceIDParams {
	o.SetGraphID(graphID)
	return o
}

// SetGraphID adds the graphId to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) SetGraphID(graphID int32) {
	o.GraphID = graphID
}

// WithInstanceID adds the instanceID to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) WithInstanceID(instanceID int32) *GetDeviceInstanceGraphDataOnlyByInstanceIDParams {
	o.SetInstanceID(instanceID)
	return o
}

// SetInstanceID adds the instanceId to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) SetInstanceID(instanceID int32) {
	o.InstanceID = instanceID
}

// WithStart adds the start to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) WithStart(start *int64) *GetDeviceInstanceGraphDataOnlyByInstanceIDParams {
	o.SetStart(start)
	return o
}

// SetStart adds the start to the get device instance graph data only by instance Id params
func (o *GetDeviceInstanceGraphDataOnlyByInstanceIDParams) SetStart(start *int64) {
	o.Start = start
}

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

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

	if o.UserAgent != nil {

		// header param User-Agent
		if err := r.SetHeaderParam("User-Agent", *o.UserAgent); err != nil {
			return err
		}
	}

	if o.End != nil {

		// query param end
		var qrEnd int64

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

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

	if o.Format != nil {

		// query param format
		var qrFormat string

		if o.Format != nil {
			qrFormat = *o.Format
		}
		qFormat := qrFormat
		if qFormat != "" {

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

	// path param graphId
	if err := r.SetPathParam("graphId", swag.FormatInt32(o.GraphID)); err != nil {
		return err
	}

	// path param instanceId
	if err := r.SetPathParam("instanceId", swag.FormatInt32(o.InstanceID)); err != nil {
		return err
	}

	if o.Start != nil {

		// query param start
		var qrStart int64

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

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

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