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

package tenant_service

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

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

// New creates a new tenant service API client with basic auth credentials.
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - user: user for basic authentication header.
// - password: password for basic authentication header.
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
	transport := httptransport.New(host, basePath, []string{scheme})
	transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
	return &Client{transport: transport, formats: strfmt.Default}
}

// New creates a new tenant service API client with a bearer token for authentication.
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - bearerToken: bearer token for Bearer authentication header.
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
	transport := httptransport.New(host, basePath, []string{scheme})
	transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
	return &Client{transport: transport, formats: strfmt.Default}
}

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

// ClientOption may be used to customize the behavior of Client methods.
type ClientOption func(*runtime.ClientOperation)

// ClientService is the interface for Client methods
type ClientService interface {
	TenantServiceAddUser(params *TenantServiceAddUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceAddUserOK, error)

	TenantServiceCreate(params *TenantServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceCreateOK, error)

	TenantServiceDelete(params *TenantServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceDeleteOK, error)

	TenantServiceDeleteUser(params *TenantServiceDeleteUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceDeleteUserOK, error)

	TenantServiceGet(params *TenantServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceGetOK, error)

	TenantServiceGetUser(params *TenantServiceGetUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceGetUserOK, error)

	TenantServiceList(params *TenantServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceListOK, error)

	TenantServiceListUsers(params *TenantServiceListUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceListUsersOK, error)

	TenantServiceUpdate(params *TenantServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceUpdateOK, error)

	TenantServiceUpdateUser(params *TenantServiceUpdateUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceUpdateUserOK, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
TenantServiceAddUser adds an user to the tenant note the user must already exist
*/
func (a *Client) TenantServiceAddUser(params *TenantServiceAddUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceAddUserOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewTenantServiceAddUserParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "TenantService_AddUser",
		Method:             "POST",
		PathPattern:        "/api/tenants/{tenantUser.tenantId}/users",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &TenantServiceAddUserReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*TenantServiceAddUserOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*TenantServiceAddUserDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
TenantServiceCreate creates a new tenant
*/
func (a *Client) TenantServiceCreate(params *TenantServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceCreateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewTenantServiceCreateParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "TenantService_Create",
		Method:             "POST",
		PathPattern:        "/api/tenants",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &TenantServiceCreateReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*TenantServiceCreateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*TenantServiceCreateDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
TenantServiceDelete deletes the tenant with the given ID
*/
func (a *Client) TenantServiceDelete(params *TenantServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceDeleteOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewTenantServiceDeleteParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "TenantService_Delete",
		Method:             "DELETE",
		PathPattern:        "/api/tenants/{id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &TenantServiceDeleteReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*TenantServiceDeleteOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*TenantServiceDeleteDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
TenantServiceDeleteUser deletes the given tenant user
*/
func (a *Client) TenantServiceDeleteUser(params *TenantServiceDeleteUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceDeleteUserOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewTenantServiceDeleteUserParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "TenantService_DeleteUser",
		Method:             "DELETE",
		PathPattern:        "/api/tenants/{tenantId}/users/{userId}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &TenantServiceDeleteUserReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*TenantServiceDeleteUserOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*TenantServiceDeleteUserDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
TenantServiceGet gets the tenant for the given ID
*/
func (a *Client) TenantServiceGet(params *TenantServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceGetOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewTenantServiceGetParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "TenantService_Get",
		Method:             "GET",
		PathPattern:        "/api/tenants/{id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &TenantServiceGetReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*TenantServiceGetOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*TenantServiceGetDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
TenantServiceGetUser gets the the tenant user for the given tenant and user i ds
*/
func (a *Client) TenantServiceGetUser(params *TenantServiceGetUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceGetUserOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewTenantServiceGetUserParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "TenantService_GetUser",
		Method:             "GET",
		PathPattern:        "/api/tenants/{tenantId}/users/{userId}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &TenantServiceGetUserReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*TenantServiceGetUserOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*TenantServiceGetUserDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
TenantServiceList gets the list of tenants
*/
func (a *Client) TenantServiceList(params *TenantServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceListOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewTenantServiceListParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "TenantService_List",
		Method:             "GET",
		PathPattern:        "/api/tenants",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &TenantServiceListReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*TenantServiceListOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*TenantServiceListDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
TenantServiceListUsers gets the list of tenant users
*/
func (a *Client) TenantServiceListUsers(params *TenantServiceListUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceListUsersOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewTenantServiceListUsersParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "TenantService_ListUsers",
		Method:             "GET",
		PathPattern:        "/api/tenants/{tenantId}/users",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &TenantServiceListUsersReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*TenantServiceListUsersOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*TenantServiceListUsersDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
TenantServiceUpdate updates the given tenant
*/
func (a *Client) TenantServiceUpdate(params *TenantServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceUpdateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewTenantServiceUpdateParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "TenantService_Update",
		Method:             "PUT",
		PathPattern:        "/api/tenants/{tenant.id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &TenantServiceUpdateReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*TenantServiceUpdateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*TenantServiceUpdateDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
TenantServiceUpdateUser updates the given tenant user
*/
func (a *Client) TenantServiceUpdateUser(params *TenantServiceUpdateUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceUpdateUserOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewTenantServiceUpdateUserParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "TenantService_UpdateUser",
		Method:             "PUT",
		PathPattern:        "/api/tenants/{tenantUser.tenantId}/users/{tenantUser.userId}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &TenantServiceUpdateUserReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*TenantServiceUpdateUserOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*TenantServiceUpdateUserDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

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