package services

import (
	"github.com/go-openapi/runtime"

	strfmt "github.com/go-openapi/strfmt"
)

func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
	return &Client{transport: transport, formats: formats}
}

type Client struct {
	transport runtime.ClientTransport
	formats   strfmt.Registry
}

func (a *Client) ControllersPublicV1ProxyGetServiceCatalogDetails(params *ControllersPublicV1ProxyGetServiceCatalogDetailsParams) (*ControllersPublicV1ProxyGetServiceCatalogDetailsOK, error) {

	if params == nil {
		params = NewControllersPublicV1ProxyGetServiceCatalogDetailsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "controllers.public.v1.proxy.get_service_catalog_details",
		Method:             "GET",
		PathPattern:        "/v1/service_catalog/{service_id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ControllersPublicV1ProxyGetServiceCatalogDetailsReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ControllersPublicV1ProxyGetServiceCatalogDetailsOK), nil

}

func (a *Client) ControllersPublicV1ProxyGetServiceCatalogList(params *ControllersPublicV1ProxyGetServiceCatalogListParams) (*ControllersPublicV1ProxyGetServiceCatalogListOK, error) {

	if params == nil {
		params = NewControllersPublicV1ProxyGetServiceCatalogListParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "controllers.public.v1.proxy.get_service_catalog_list",
		Method:             "GET",
		PathPattern:        "/v1/service_catalog",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ControllersPublicV1ProxyGetServiceCatalogListReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ControllersPublicV1ProxyGetServiceCatalogListOK), nil

}

func (a *Client) ControllersPublicV1ProxyGetVcenterService(params *ControllersPublicV1ProxyGetVcenterServiceParams) (*ControllersPublicV1ProxyGetVcenterServiceOK, error) {

	if params == nil {
		params = NewControllersPublicV1ProxyGetVcenterServiceParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "controllers.public.v1.proxy.get_vcenter_service",
		Method:             "GET",
		PathPattern:        "/v1/vcenters/{instance_id}/service_instances/{service_instance_id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ControllersPublicV1ProxyGetVcenterServiceReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ControllersPublicV1ProxyGetVcenterServiceOK), nil

}

func (a *Client) ControllersPublicV1ProxyListVcenterServices(params *ControllersPublicV1ProxyListVcenterServicesParams) (*ControllersPublicV1ProxyListVcenterServicesOK, error) {

	if params == nil {
		params = NewControllersPublicV1ProxyListVcenterServicesParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "controllers.public.v1.proxy.list_vcenter_services",
		Method:             "GET",
		PathPattern:        "/v1/vcenters/{instance_id}/service_instances",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ControllersPublicV1ProxyListVcenterServicesReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ControllersPublicV1ProxyListVcenterServicesOK), nil

}

func (a *Client) ControllersPublicV1ProxyMutateServiceVariables(params *ControllersPublicV1ProxyMutateServiceVariablesParams) (*ControllersPublicV1ProxyMutateServiceVariablesAccepted, error) {

	if params == nil {
		params = NewControllersPublicV1ProxyMutateServiceVariablesParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "controllers.public.v1.proxy.mutate_service_variables",
		Method:             "PATCH",
		PathPattern:        "/v1/service_instances/{service_instance_id}/service_variables",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ControllersPublicV1ProxyMutateServiceVariablesReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ControllersPublicV1ProxyMutateServiceVariablesAccepted), nil

}

func (a *Client) ControllersPublicV1ProxyOrderVcenterService(params *ControllersPublicV1ProxyOrderVcenterServiceParams) (*ControllersPublicV1ProxyOrderVcenterServiceOK, *ControllersPublicV1ProxyOrderVcenterServiceAccepted, error) {

	if params == nil {
		params = NewControllersPublicV1ProxyOrderVcenterServiceParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "controllers.public.v1.proxy.order_vcenter_service",
		Method:             "POST",
		PathPattern:        "/v1/vcenters/{instance_id}/service_instances",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ControllersPublicV1ProxyOrderVcenterServiceReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, nil, err
	}
	switch value := result.(type) {
	case *ControllersPublicV1ProxyOrderVcenterServiceOK:
		return value, nil, nil
	case *ControllersPublicV1ProxyOrderVcenterServiceAccepted:
		return nil, value, nil
	}
	return nil, nil, nil

}

func (a *Client) ControllersV1ServiceControllerRemoveServiceAppliedToVMInsts(params *ControllersV1ServiceControllerRemoveServiceAppliedToVMInstsParams) (*ControllersV1ServiceControllerRemoveServiceAppliedToVMInstsAccepted, error) {

	if params == nil {
		params = NewControllersV1ServiceControllerRemoveServiceAppliedToVMInstsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "controllers.v1.service_controller.remove_service_applied_to_vm_insts",
		Method:             "DELETE",
		PathPattern:        "/v1/vcenters/{instance_id}/service_instances/{service_instance_id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ControllersV1ServiceControllerRemoveServiceAppliedToVMInstsReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ControllersV1ServiceControllerRemoveServiceAppliedToVMInstsAccepted), nil

}

func (a *Client) SetTransport(transport runtime.ClientTransport) {
	a.transport = transport
}
// Code generated by go-swagger; DO NOT EDIT.

package services

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

	strfmt "github.com/go-openapi/strfmt"
)

// New creates a new services API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
	return &Client{transport: transport, formats: formats}
}

/*
Client for services API
*/
type Client struct {
	transport runtime.ClientTransport
	formats   strfmt.Registry
}

/*
ControllersPublicV1ProxyGetServiceCatalogDetails retrieves service information

Retrieve the detailed information on the service, including the set of necessary input fields, and their available options, for ordering the service, the service name, and an explanation of the service
*/
func (a *Client) ControllersPublicV1ProxyGetServiceCatalogDetails(params *ControllersPublicV1ProxyGetServiceCatalogDetailsParams) (*ControllersPublicV1ProxyGetServiceCatalogDetailsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewControllersPublicV1ProxyGetServiceCatalogDetailsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "controllers.public.v1.proxy.get_service_catalog_details",
		Method:             "GET",
		PathPattern:        "/v1/service_catalog/{service_id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ControllersPublicV1ProxyGetServiceCatalogDetailsReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ControllersPublicV1ProxyGetServiceCatalogDetailsOK), nil

}

/*
ControllersPublicV1ProxyGetServiceCatalogList gets list of available services

Get the list of all available service offerings.
*/
func (a *Client) ControllersPublicV1ProxyGetServiceCatalogList(params *ControllersPublicV1ProxyGetServiceCatalogListParams) (*ControllersPublicV1ProxyGetServiceCatalogListOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewControllersPublicV1ProxyGetServiceCatalogListParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "controllers.public.v1.proxy.get_service_catalog_list",
		Method:             "GET",
		PathPattern:        "/v1/service_catalog",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ControllersPublicV1ProxyGetServiceCatalogListReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ControllersPublicV1ProxyGetServiceCatalogListOK), nil

}

/*
ControllersPublicV1ProxyGetVcenterService retrieves specified service instance information on an instance

Retrieve the detailed information of a specified service deployed in a specified vCenter Server instance.
*/
func (a *Client) ControllersPublicV1ProxyGetVcenterService(params *ControllersPublicV1ProxyGetVcenterServiceParams) (*ControllersPublicV1ProxyGetVcenterServiceOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewControllersPublicV1ProxyGetVcenterServiceParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "controllers.public.v1.proxy.get_vcenter_service",
		Method:             "GET",
		PathPattern:        "/v1/vcenters/{instance_id}/service_instances/{service_instance_id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ControllersPublicV1ProxyGetVcenterServiceReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ControllersPublicV1ProxyGetVcenterServiceOK), nil

}

/*
ControllersPublicV1ProxyListVcenterServices lists services on instance

List all the services on a specified vCenter Server instance.
*/
func (a *Client) ControllersPublicV1ProxyListVcenterServices(params *ControllersPublicV1ProxyListVcenterServicesParams) (*ControllersPublicV1ProxyListVcenterServicesOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewControllersPublicV1ProxyListVcenterServicesParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "controllers.public.v1.proxy.list_vcenter_services",
		Method:             "GET",
		PathPattern:        "/v1/vcenters/{instance_id}/service_instances",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ControllersPublicV1ProxyListVcenterServicesReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ControllersPublicV1ProxyListVcenterServicesOK), nil

}

/*
ControllersPublicV1ProxyMutateServiceVariables updates or delete variables of service instance

Add, modify, or delete the variables of a service instance.
*/
func (a *Client) ControllersPublicV1ProxyMutateServiceVariables(params *ControllersPublicV1ProxyMutateServiceVariablesParams) (*ControllersPublicV1ProxyMutateServiceVariablesAccepted, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewControllersPublicV1ProxyMutateServiceVariablesParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "controllers.public.v1.proxy.mutate_service_variables",
		Method:             "PATCH",
		PathPattern:        "/v1/service_instances/{service_instance_id}/service_variables",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ControllersPublicV1ProxyMutateServiceVariablesReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ControllersPublicV1ProxyMutateServiceVariablesAccepted), nil

}

/*
ControllersPublicV1ProxyOrderVcenterService adds services or verify order

Add service or services for a specified vCenter Server instance, verify the order, and check the price
*/
func (a *Client) ControllersPublicV1ProxyOrderVcenterService(params *ControllersPublicV1ProxyOrderVcenterServiceParams) (*ControllersPublicV1ProxyOrderVcenterServiceOK, *ControllersPublicV1ProxyOrderVcenterServiceAccepted, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewControllersPublicV1ProxyOrderVcenterServiceParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "controllers.public.v1.proxy.order_vcenter_service",
		Method:             "POST",
		PathPattern:        "/v1/vcenters/{instance_id}/service_instances",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ControllersPublicV1ProxyOrderVcenterServiceReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, nil, err
	}
	switch value := result.(type) {
	case *ControllersPublicV1ProxyOrderVcenterServiceOK:
		return value, nil, nil
	case *ControllersPublicV1ProxyOrderVcenterServiceAccepted:
		return nil, value, nil
	}
	return nil, nil, nil

}

/*
ControllersV1ServiceControllerRemoveServiceAppliedToVMInsts deletes specified service instance on an instance

Deletes the specified service instance installed on the vCenter Server instance by the instance ID of the service.
*/
func (a *Client) ControllersV1ServiceControllerRemoveServiceAppliedToVMInsts(params *ControllersV1ServiceControllerRemoveServiceAppliedToVMInstsParams) (*ControllersV1ServiceControllerRemoveServiceAppliedToVMInstsAccepted, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewControllersV1ServiceControllerRemoveServiceAppliedToVMInstsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "controllers.v1.service_controller.remove_service_applied_to_vm_insts",
		Method:             "DELETE",
		PathPattern:        "/v1/vcenters/{instance_id}/service_instances/{service_instance_id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ControllersV1ServiceControllerRemoveServiceAppliedToVMInstsReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ControllersV1ServiceControllerRemoveServiceAppliedToVMInstsAccepted), nil

}

// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
	a.transport = transport
}
