// This file was generated by counterfeiter
package databasefakes

import (
	"sync"

	"quota-enforcer/database"
)

type FakeDatabase struct {
	NameStub        func() string
	nameMutex       sync.RWMutex
	nameArgsForCall []struct{}
	nameReturns     struct {
		result1 string
	}
	GrantPrivilegesStub        func() error
	grantPrivilegesMutex       sync.RWMutex
	grantPrivilegesArgsForCall []struct{}
	grantPrivilegesReturns     struct {
		result1 error
	}
	RevokePrivilegesStub        func() error
	revokePrivilegesMutex       sync.RWMutex
	revokePrivilegesArgsForCall []struct{}
	revokePrivilegesReturns     struct {
		result1 error
	}
	KillActiveConnectionsStub        func() error
	killActiveConnectionsMutex       sync.RWMutex
	killActiveConnectionsArgsForCall []struct{}
	killActiveConnectionsReturns     struct {
		result1 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeDatabase) Name() string {
	fake.nameMutex.Lock()
	fake.nameArgsForCall = append(fake.nameArgsForCall, struct{}{})
	fake.recordInvocation("Name", []interface{}{})
	fake.nameMutex.Unlock()
	if fake.NameStub != nil {
		return fake.NameStub()
	} else {
		return fake.nameReturns.result1
	}
}

func (fake *FakeDatabase) NameCallCount() int {
	fake.nameMutex.RLock()
	defer fake.nameMutex.RUnlock()
	return len(fake.nameArgsForCall)
}

func (fake *FakeDatabase) NameReturns(result1 string) {
	fake.NameStub = nil
	fake.nameReturns = struct {
		result1 string
	}{result1}
}

func (fake *FakeDatabase) GrantPrivileges() error {
	fake.grantPrivilegesMutex.Lock()
	fake.grantPrivilegesArgsForCall = append(fake.grantPrivilegesArgsForCall, struct{}{})
	fake.recordInvocation("GrantPrivileges", []interface{}{})
	fake.grantPrivilegesMutex.Unlock()
	if fake.GrantPrivilegesStub != nil {
		return fake.GrantPrivilegesStub()
	} else {
		return fake.grantPrivilegesReturns.result1
	}
}

func (fake *FakeDatabase) GrantPrivilegesCallCount() int {
	fake.grantPrivilegesMutex.RLock()
	defer fake.grantPrivilegesMutex.RUnlock()
	return len(fake.grantPrivilegesArgsForCall)
}

func (fake *FakeDatabase) GrantPrivilegesReturns(result1 error) {
	fake.GrantPrivilegesStub = nil
	fake.grantPrivilegesReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeDatabase) RevokePrivileges() error {
	fake.revokePrivilegesMutex.Lock()
	fake.revokePrivilegesArgsForCall = append(fake.revokePrivilegesArgsForCall, struct{}{})
	fake.recordInvocation("RevokePrivileges", []interface{}{})
	fake.revokePrivilegesMutex.Unlock()
	if fake.RevokePrivilegesStub != nil {
		return fake.RevokePrivilegesStub()
	} else {
		return fake.revokePrivilegesReturns.result1
	}
}

func (fake *FakeDatabase) RevokePrivilegesCallCount() int {
	fake.revokePrivilegesMutex.RLock()
	defer fake.revokePrivilegesMutex.RUnlock()
	return len(fake.revokePrivilegesArgsForCall)
}

func (fake *FakeDatabase) RevokePrivilegesReturns(result1 error) {
	fake.RevokePrivilegesStub = nil
	fake.revokePrivilegesReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeDatabase) KillActiveConnections() error {
	fake.killActiveConnectionsMutex.Lock()
	fake.killActiveConnectionsArgsForCall = append(fake.killActiveConnectionsArgsForCall, struct{}{})
	fake.recordInvocation("KillActiveConnections", []interface{}{})
	fake.killActiveConnectionsMutex.Unlock()
	if fake.KillActiveConnectionsStub != nil {
		return fake.KillActiveConnectionsStub()
	} else {
		return fake.killActiveConnectionsReturns.result1
	}
}

func (fake *FakeDatabase) KillActiveConnectionsCallCount() int {
	fake.killActiveConnectionsMutex.RLock()
	defer fake.killActiveConnectionsMutex.RUnlock()
	return len(fake.killActiveConnectionsArgsForCall)
}

func (fake *FakeDatabase) KillActiveConnectionsReturns(result1 error) {
	fake.KillActiveConnectionsStub = nil
	fake.killActiveConnectionsReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeDatabase) Invocations() map[string][][]interface{} {
	fake.invocationsMutex.RLock()
	defer fake.invocationsMutex.RUnlock()
	fake.nameMutex.RLock()
	defer fake.nameMutex.RUnlock()
	fake.grantPrivilegesMutex.RLock()
	defer fake.grantPrivilegesMutex.RUnlock()
	fake.revokePrivilegesMutex.RLock()
	defer fake.revokePrivilegesMutex.RUnlock()
	fake.killActiveConnectionsMutex.RLock()
	defer fake.killActiveConnectionsMutex.RUnlock()
	return fake.invocations
}

func (fake *FakeDatabase) 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 _ database.Database = new(FakeDatabase)
