// This file was generated by counterfeiter
package apihubfakes

import (
	"sync"

	"github.com/apihub/apihub"
)

type FakeClient struct {
	PingStub        func() error
	pingMutex       sync.RWMutex
	pingArgsForCall []struct{}
	pingReturns     struct {
		result1 error
	}
	AddServiceStub        func(apihub.ServiceSpec) (apihub.Service, error)
	addServiceMutex       sync.RWMutex
	addServiceArgsForCall []struct {
		arg1 apihub.ServiceSpec
	}
	addServiceReturns struct {
		result1 apihub.Service
		result2 error
	}
	RemoveServiceStub        func(host string) error
	removeServiceMutex       sync.RWMutex
	removeServiceArgsForCall []struct {
		host string
	}
	removeServiceReturns struct {
		result1 error
	}
	ServicesStub        func() ([]apihub.Service, error)
	servicesMutex       sync.RWMutex
	servicesArgsForCall []struct{}
	servicesReturns     struct {
		result1 []apihub.Service
		result2 error
	}
	FindServiceStub        func(host string) (apihub.Service, error)
	findServiceMutex       sync.RWMutex
	findServiceArgsForCall []struct {
		host string
	}
	findServiceReturns struct {
		result1 apihub.Service
		result2 error
	}
	UpdateServiceStub        func(string, apihub.ServiceSpec) (apihub.Service, error)
	updateServiceMutex       sync.RWMutex
	updateServiceArgsForCall []struct {
		arg1 string
		arg2 apihub.ServiceSpec
	}
	updateServiceReturns struct {
		result1 apihub.Service
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeClient) Ping() error {
	fake.pingMutex.Lock()
	fake.pingArgsForCall = append(fake.pingArgsForCall, struct{}{})
	fake.recordInvocation("Ping", []interface{}{})
	fake.pingMutex.Unlock()
	if fake.PingStub != nil {
		return fake.PingStub()
	} else {
		return fake.pingReturns.result1
	}
}

func (fake *FakeClient) PingCallCount() int {
	fake.pingMutex.RLock()
	defer fake.pingMutex.RUnlock()
	return len(fake.pingArgsForCall)
}

func (fake *FakeClient) PingReturns(result1 error) {
	fake.PingStub = nil
	fake.pingReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeClient) AddService(arg1 apihub.ServiceSpec) (apihub.Service, error) {
	fake.addServiceMutex.Lock()
	fake.addServiceArgsForCall = append(fake.addServiceArgsForCall, struct {
		arg1 apihub.ServiceSpec
	}{arg1})
	fake.recordInvocation("AddService", []interface{}{arg1})
	fake.addServiceMutex.Unlock()
	if fake.AddServiceStub != nil {
		return fake.AddServiceStub(arg1)
	} else {
		return fake.addServiceReturns.result1, fake.addServiceReturns.result2
	}
}

func (fake *FakeClient) AddServiceCallCount() int {
	fake.addServiceMutex.RLock()
	defer fake.addServiceMutex.RUnlock()
	return len(fake.addServiceArgsForCall)
}

func (fake *FakeClient) AddServiceArgsForCall(i int) apihub.ServiceSpec {
	fake.addServiceMutex.RLock()
	defer fake.addServiceMutex.RUnlock()
	return fake.addServiceArgsForCall[i].arg1
}

func (fake *FakeClient) AddServiceReturns(result1 apihub.Service, result2 error) {
	fake.AddServiceStub = nil
	fake.addServiceReturns = struct {
		result1 apihub.Service
		result2 error
	}{result1, result2}
}

func (fake *FakeClient) RemoveService(host string) error {
	fake.removeServiceMutex.Lock()
	fake.removeServiceArgsForCall = append(fake.removeServiceArgsForCall, struct {
		host string
	}{host})
	fake.recordInvocation("RemoveService", []interface{}{host})
	fake.removeServiceMutex.Unlock()
	if fake.RemoveServiceStub != nil {
		return fake.RemoveServiceStub(host)
	} else {
		return fake.removeServiceReturns.result1
	}
}

func (fake *FakeClient) RemoveServiceCallCount() int {
	fake.removeServiceMutex.RLock()
	defer fake.removeServiceMutex.RUnlock()
	return len(fake.removeServiceArgsForCall)
}

func (fake *FakeClient) RemoveServiceArgsForCall(i int) string {
	fake.removeServiceMutex.RLock()
	defer fake.removeServiceMutex.RUnlock()
	return fake.removeServiceArgsForCall[i].host
}

func (fake *FakeClient) RemoveServiceReturns(result1 error) {
	fake.RemoveServiceStub = nil
	fake.removeServiceReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeClient) Services() ([]apihub.Service, error) {
	fake.servicesMutex.Lock()
	fake.servicesArgsForCall = append(fake.servicesArgsForCall, struct{}{})
	fake.recordInvocation("Services", []interface{}{})
	fake.servicesMutex.Unlock()
	if fake.ServicesStub != nil {
		return fake.ServicesStub()
	} else {
		return fake.servicesReturns.result1, fake.servicesReturns.result2
	}
}

func (fake *FakeClient) ServicesCallCount() int {
	fake.servicesMutex.RLock()
	defer fake.servicesMutex.RUnlock()
	return len(fake.servicesArgsForCall)
}

func (fake *FakeClient) ServicesReturns(result1 []apihub.Service, result2 error) {
	fake.ServicesStub = nil
	fake.servicesReturns = struct {
		result1 []apihub.Service
		result2 error
	}{result1, result2}
}

func (fake *FakeClient) FindService(host string) (apihub.Service, error) {
	fake.findServiceMutex.Lock()
	fake.findServiceArgsForCall = append(fake.findServiceArgsForCall, struct {
		host string
	}{host})
	fake.recordInvocation("FindService", []interface{}{host})
	fake.findServiceMutex.Unlock()
	if fake.FindServiceStub != nil {
		return fake.FindServiceStub(host)
	} else {
		return fake.findServiceReturns.result1, fake.findServiceReturns.result2
	}
}

func (fake *FakeClient) FindServiceCallCount() int {
	fake.findServiceMutex.RLock()
	defer fake.findServiceMutex.RUnlock()
	return len(fake.findServiceArgsForCall)
}

func (fake *FakeClient) FindServiceArgsForCall(i int) string {
	fake.findServiceMutex.RLock()
	defer fake.findServiceMutex.RUnlock()
	return fake.findServiceArgsForCall[i].host
}

func (fake *FakeClient) FindServiceReturns(result1 apihub.Service, result2 error) {
	fake.FindServiceStub = nil
	fake.findServiceReturns = struct {
		result1 apihub.Service
		result2 error
	}{result1, result2}
}

func (fake *FakeClient) UpdateService(arg1 string, arg2 apihub.ServiceSpec) (apihub.Service, error) {
	fake.updateServiceMutex.Lock()
	fake.updateServiceArgsForCall = append(fake.updateServiceArgsForCall, struct {
		arg1 string
		arg2 apihub.ServiceSpec
	}{arg1, arg2})
	fake.recordInvocation("UpdateService", []interface{}{arg1, arg2})
	fake.updateServiceMutex.Unlock()
	if fake.UpdateServiceStub != nil {
		return fake.UpdateServiceStub(arg1, arg2)
	} else {
		return fake.updateServiceReturns.result1, fake.updateServiceReturns.result2
	}
}

func (fake *FakeClient) UpdateServiceCallCount() int {
	fake.updateServiceMutex.RLock()
	defer fake.updateServiceMutex.RUnlock()
	return len(fake.updateServiceArgsForCall)
}

func (fake *FakeClient) UpdateServiceArgsForCall(i int) (string, apihub.ServiceSpec) {
	fake.updateServiceMutex.RLock()
	defer fake.updateServiceMutex.RUnlock()
	return fake.updateServiceArgsForCall[i].arg1, fake.updateServiceArgsForCall[i].arg2
}

func (fake *FakeClient) UpdateServiceReturns(result1 apihub.Service, result2 error) {
	fake.UpdateServiceStub = nil
	fake.updateServiceReturns = struct {
		result1 apihub.Service
		result2 error
	}{result1, result2}
}

func (fake *FakeClient) Invocations() map[string][][]interface{} {
	fake.invocationsMutex.RLock()
	defer fake.invocationsMutex.RUnlock()
	fake.pingMutex.RLock()
	defer fake.pingMutex.RUnlock()
	fake.addServiceMutex.RLock()
	defer fake.addServiceMutex.RUnlock()
	fake.removeServiceMutex.RLock()
	defer fake.removeServiceMutex.RUnlock()
	fake.servicesMutex.RLock()
	defer fake.servicesMutex.RUnlock()
	fake.findServiceMutex.RLock()
	defer fake.findServiceMutex.RUnlock()
	fake.updateServiceMutex.RLock()
	defer fake.updateServiceMutex.RUnlock()
	return fake.invocations
}

func (fake *FakeClient) recordInvocation(key string, args []interface{}) {
	fake.invocationsMutex.Lock()
	defer fake.invocationsMutex.Unlock()
	if fake.invocations == nil {
		fake.invocations = map[string][][]interface{}{}
	}
	if fake.invocations[key] == nil {
		fake.invocations[key] = [][]interface{}{}
	}
	fake.invocations[key] = append(fake.invocations[key], args)
}

var _ apihub.Client = new(FakeClient)
