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

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

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

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

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

/* ImportDataSourceParams contains all the parameters to send to the API endpoint
   for the import data source operation.

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

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

	// File.
	File runtime.NamedReadCloser

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

// WithDefaults hydrates default values in the import data source params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ImportDataSourceParams) WithDefaults() *ImportDataSourceParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the import data source params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ImportDataSourceParams) SetDefaults() {
	var (
		userAgentDefault = string("Logicmonitor/SDK: Argus Dist-v1.0.0-argus1")
	)

	val := ImportDataSourceParams{
		UserAgent: &userAgentDefault,
	}

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

// WithTimeout adds the timeout to the import data source params
func (o *ImportDataSourceParams) WithTimeout(timeout time.Duration) *ImportDataSourceParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the import data source params
func (o *ImportDataSourceParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the import data source params
func (o *ImportDataSourceParams) WithContext(ctx context.Context) *ImportDataSourceParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the import data source params
func (o *ImportDataSourceParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the import data source params
func (o *ImportDataSourceParams) WithHTTPClient(client *http.Client) *ImportDataSourceParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the import data source params
func (o *ImportDataSourceParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithUserAgent adds the userAgent to the import data source params
func (o *ImportDataSourceParams) WithUserAgent(userAgent *string) *ImportDataSourceParams {
	o.SetUserAgent(userAgent)
	return o
}

// SetUserAgent adds the userAgent to the import data source params
func (o *ImportDataSourceParams) SetUserAgent(userAgent *string) {
	o.UserAgent = userAgent
}

// WithFile adds the file to the import data source params
func (o *ImportDataSourceParams) WithFile(file runtime.NamedReadCloser) *ImportDataSourceParams {
	o.SetFile(file)
	return o
}

// SetFile adds the file to the import data source params
func (o *ImportDataSourceParams) SetFile(file runtime.NamedReadCloser) {
	o.File = file
}

// WriteToRequest writes these params to a swagger request
func (o *ImportDataSourceParams) 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
		}
	}
	// form file param file
	if err := r.SetFileParam("file", o.File); err != nil {
		return err
	}

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