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

import (
	"sync"

	"code.cloudfoundry.org/policy-server/store"
	"code.cloudfoundry.org/policy-server/store/migrations"
)

type Migrator struct {
	PerformMigrationsStub        func(string, migrations.MigrationDb, int) (int, error)
	performMigrationsMutex       sync.RWMutex
	performMigrationsArgsForCall []struct {
		arg1 string
		arg2 migrations.MigrationDb
		arg3 int
	}
	performMigrationsReturns struct {
		result1 int
		result2 error
	}
	performMigrationsReturnsOnCall map[int]struct {
		result1 int
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *Migrator) PerformMigrations(arg1 string, arg2 migrations.MigrationDb, arg3 int) (int, error) {
	fake.performMigrationsMutex.Lock()
	ret, specificReturn := fake.performMigrationsReturnsOnCall[len(fake.performMigrationsArgsForCall)]
	fake.performMigrationsArgsForCall = append(fake.performMigrationsArgsForCall, struct {
		arg1 string
		arg2 migrations.MigrationDb
		arg3 int
	}{arg1, arg2, arg3})
	stub := fake.PerformMigrationsStub
	fakeReturns := fake.performMigrationsReturns
	fake.recordInvocation("PerformMigrations", []interface{}{arg1, arg2, arg3})
	fake.performMigrationsMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *Migrator) PerformMigrationsCallCount() int {
	fake.performMigrationsMutex.RLock()
	defer fake.performMigrationsMutex.RUnlock()
	return len(fake.performMigrationsArgsForCall)
}

func (fake *Migrator) PerformMigrationsCalls(stub func(string, migrations.MigrationDb, int) (int, error)) {
	fake.performMigrationsMutex.Lock()
	defer fake.performMigrationsMutex.Unlock()
	fake.PerformMigrationsStub = stub
}

func (fake *Migrator) PerformMigrationsArgsForCall(i int) (string, migrations.MigrationDb, int) {
	fake.performMigrationsMutex.RLock()
	defer fake.performMigrationsMutex.RUnlock()
	argsForCall := fake.performMigrationsArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}

func (fake *Migrator) PerformMigrationsReturns(result1 int, result2 error) {
	fake.performMigrationsMutex.Lock()
	defer fake.performMigrationsMutex.Unlock()
	fake.PerformMigrationsStub = nil
	fake.performMigrationsReturns = struct {
		result1 int
		result2 error
	}{result1, result2}
}

func (fake *Migrator) PerformMigrationsReturnsOnCall(i int, result1 int, result2 error) {
	fake.performMigrationsMutex.Lock()
	defer fake.performMigrationsMutex.Unlock()
	fake.PerformMigrationsStub = nil
	if fake.performMigrationsReturnsOnCall == nil {
		fake.performMigrationsReturnsOnCall = make(map[int]struct {
			result1 int
			result2 error
		})
	}
	fake.performMigrationsReturnsOnCall[i] = struct {
		result1 int
		result2 error
	}{result1, result2}
}

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

func (fake *Migrator) 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 _ store.Migrator = new(Migrator)
