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

package client

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"github.com/go-openapi/runtime"
	httptransport "github.com/go-openapi/runtime/client"
	"github.com/go-openapi/strfmt"

	"github.com/cloudbase/garm/client/controller"
	"github.com/cloudbase/garm/client/controller_info"
	"github.com/cloudbase/garm/client/credentials"
	"github.com/cloudbase/garm/client/endpoints"
	"github.com/cloudbase/garm/client/enterprises"
	"github.com/cloudbase/garm/client/first_run"
	"github.com/cloudbase/garm/client/instances"
	"github.com/cloudbase/garm/client/jobs"
	"github.com/cloudbase/garm/client/login"
	"github.com/cloudbase/garm/client/metrics_token"
	"github.com/cloudbase/garm/client/objects"
	"github.com/cloudbase/garm/client/organizations"
	"github.com/cloudbase/garm/client/pools"
	"github.com/cloudbase/garm/client/providers"
	"github.com/cloudbase/garm/client/repositories"
	"github.com/cloudbase/garm/client/scalesets"
	"github.com/cloudbase/garm/client/templates"
)

// Default garm API HTTP client.
var Default = NewHTTPClient(nil)

const (
	// DefaultHost is the default Host
	// found in Meta (info) section of spec file
	DefaultHost string = "localhost"
	// DefaultBasePath is the default BasePath
	// found in Meta (info) section of spec file
	DefaultBasePath string = "/api/v1"
)

// DefaultSchemes are the default schemes found in Meta (info) section of spec file
var DefaultSchemes = []string{"http"}

// NewHTTPClient creates a new garm API HTTP client.
func NewHTTPClient(formats strfmt.Registry) *GarmAPI {
	return NewHTTPClientWithConfig(formats, nil)
}

// NewHTTPClientWithConfig creates a new garm API HTTP client,
// using a customizable transport config.
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *GarmAPI {
	// ensure nullable parameters have default
	if cfg == nil {
		cfg = DefaultTransportConfig()
	}

	// create transport and client
	transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
	return New(transport, formats)
}

// New creates a new garm API client
func New(transport runtime.ClientTransport, formats strfmt.Registry) *GarmAPI {
	// ensure nullable parameters have default
	if formats == nil {
		formats = strfmt.Default
	}

	cli := new(GarmAPI)
	cli.Transport = transport
	cli.Controller = controller.New(transport, formats)
	cli.ControllerInfo = controller_info.New(transport, formats)
	cli.Credentials = credentials.New(transport, formats)
	cli.Endpoints = endpoints.New(transport, formats)
	cli.Enterprises = enterprises.New(transport, formats)
	cli.FirstRun = first_run.New(transport, formats)
	cli.Instances = instances.New(transport, formats)
	cli.Jobs = jobs.New(transport, formats)
	cli.Login = login.New(transport, formats)
	cli.MetricsToken = metrics_token.New(transport, formats)
	cli.Objects = objects.New(transport, formats)
	cli.Organizations = organizations.New(transport, formats)
	cli.Pools = pools.New(transport, formats)
	cli.Providers = providers.New(transport, formats)
	cli.Repositories = repositories.New(transport, formats)
	cli.Scalesets = scalesets.New(transport, formats)
	cli.Templates = templates.New(transport, formats)
	return cli
}

// DefaultTransportConfig creates a TransportConfig with the
// default settings taken from the meta section of the spec file.
func DefaultTransportConfig() *TransportConfig {
	return &TransportConfig{
		Host:     DefaultHost,
		BasePath: DefaultBasePath,
		Schemes:  DefaultSchemes,
	}
}

// TransportConfig contains the transport related info,
// found in the meta section of the spec file.
type TransportConfig struct {
	Host     string
	BasePath string
	Schemes  []string
}

// WithHost overrides the default host,
// provided by the meta section of the spec file.
func (cfg *TransportConfig) WithHost(host string) *TransportConfig {
	cfg.Host = host
	return cfg
}

// WithBasePath overrides the default basePath,
// provided by the meta section of the spec file.
func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {
	cfg.BasePath = basePath
	return cfg
}

// WithSchemes overrides the default schemes,
// provided by the meta section of the spec file.
func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
	cfg.Schemes = schemes
	return cfg
}

// GarmAPI is a client for garm API
type GarmAPI struct {
	Controller controller.ClientService

	ControllerInfo controller_info.ClientService

	Credentials credentials.ClientService

	Endpoints endpoints.ClientService

	Enterprises enterprises.ClientService

	FirstRun first_run.ClientService

	Instances instances.ClientService

	Jobs jobs.ClientService

	Login login.ClientService

	MetricsToken metrics_token.ClientService

	Objects objects.ClientService

	Organizations organizations.ClientService

	Pools pools.ClientService

	Providers providers.ClientService

	Repositories repositories.ClientService

	Scalesets scalesets.ClientService

	Templates templates.ClientService

	Transport runtime.ClientTransport
}

// SetTransport changes the transport on the client and all its subresources
func (c *GarmAPI) SetTransport(transport runtime.ClientTransport) {
	c.Transport = transport
	c.Controller.SetTransport(transport)
	c.ControllerInfo.SetTransport(transport)
	c.Credentials.SetTransport(transport)
	c.Endpoints.SetTransport(transport)
	c.Enterprises.SetTransport(transport)
	c.FirstRun.SetTransport(transport)
	c.Instances.SetTransport(transport)
	c.Jobs.SetTransport(transport)
	c.Login.SetTransport(transport)
	c.MetricsToken.SetTransport(transport)
	c.Objects.SetTransport(transport)
	c.Organizations.SetTransport(transport)
	c.Pools.SetTransport(transport)
	c.Providers.SetTransport(transport)
	c.Repositories.SetTransport(transport)
	c.Scalesets.SetTransport(transport)
	c.Templates.SetTransport(transport)
}
