// Code generated by counterfeiter. DO NOT EDIT.
package fakes

import (
	"sync"

	"code.cloudfoundry.org/policy-server/store/migrations"
	migrate "github.com/rubenv/sql-migrate"
)

type MigrateAdapter struct {
	ExecMaxStub        func(migrations.MigrationDb, string, migrate.MigrationSource, migrate.MigrationDirection, int) (int, error)
	execMaxMutex       sync.RWMutex
	execMaxArgsForCall []struct {
		arg1 migrations.MigrationDb
		arg2 string
		arg3 migrate.MigrationSource
		arg4 migrate.MigrationDirection
		arg5 int
	}
	execMaxReturns struct {
		result1 int
		result2 error
	}
	execMaxReturnsOnCall map[int]struct {
		result1 int
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *MigrateAdapter) ExecMax(arg1 migrations.MigrationDb, arg2 string, arg3 migrate.MigrationSource, arg4 migrate.MigrationDirection, arg5 int) (int, error) {
	fake.execMaxMutex.Lock()
	ret, specificReturn := fake.execMaxReturnsOnCall[len(fake.execMaxArgsForCall)]
	fake.execMaxArgsForCall = append(fake.execMaxArgsForCall, struct {
		arg1 migrations.MigrationDb
		arg2 string
		arg3 migrate.MigrationSource
		arg4 migrate.MigrationDirection
		arg5 int
	}{arg1, arg2, arg3, arg4, arg5})
	stub := fake.ExecMaxStub
	fakeReturns := fake.execMaxReturns
	fake.recordInvocation("ExecMax", []interface{}{arg1, arg2, arg3, arg4, arg5})
	fake.execMaxMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3, arg4, arg5)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *MigrateAdapter) ExecMaxCallCount() int {
	fake.execMaxMutex.RLock()
	defer fake.execMaxMutex.RUnlock()
	return len(fake.execMaxArgsForCall)
}

func (fake *MigrateAdapter) ExecMaxCalls(stub func(migrations.MigrationDb, string, migrate.MigrationSource, migrate.MigrationDirection, int) (int, error)) {
	fake.execMaxMutex.Lock()
	defer fake.execMaxMutex.Unlock()
	fake.ExecMaxStub = stub
}

func (fake *MigrateAdapter) ExecMaxArgsForCall(i int) (migrations.MigrationDb, string, migrate.MigrationSource, migrate.MigrationDirection, int) {
	fake.execMaxMutex.RLock()
	defer fake.execMaxMutex.RUnlock()
	argsForCall := fake.execMaxArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5
}

func (fake *MigrateAdapter) ExecMaxReturns(result1 int, result2 error) {
	fake.execMaxMutex.Lock()
	defer fake.execMaxMutex.Unlock()
	fake.ExecMaxStub = nil
	fake.execMaxReturns = struct {
		result1 int
		result2 error
	}{result1, result2}
}

func (fake *MigrateAdapter) ExecMaxReturnsOnCall(i int, result1 int, result2 error) {
	fake.execMaxMutex.Lock()
	defer fake.execMaxMutex.Unlock()
	fake.ExecMaxStub = nil
	if fake.execMaxReturnsOnCall == nil {
		fake.execMaxReturnsOnCall = make(map[int]struct {
			result1 int
			result2 error
		})
	}
	fake.execMaxReturnsOnCall[i] = struct {
		result1 int
		result2 error
	}{result1, result2}
}

func (fake *MigrateAdapter) Invocations() map[string][][]interface{} {
	fake.invocationsMutex.RLock()
	defer fake.invocationsMutex.RUnlock()
	fake.execMaxMutex.RLock()
	defer fake.execMaxMutex.RUnlock()
	copiedInvocations := map[string][][]interface{}{}
	for key, value := range fake.invocations {
		copiedInvocations[key] = value
	}
	return copiedInvocations
}

func (fake *MigrateAdapter) 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)
}
