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

import (
	"sync"

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

type MigrationsProvider struct {
	MigrationsToPerformStub        func() (migrations.PolicyServerMigrations, error)
	migrationsToPerformMutex       sync.RWMutex
	migrationsToPerformArgsForCall []struct {
	}
	migrationsToPerformReturns struct {
		result1 migrations.PolicyServerMigrations
		result2 error
	}
	migrationsToPerformReturnsOnCall map[int]struct {
		result1 migrations.PolicyServerMigrations
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *MigrationsProvider) MigrationsToPerform() (migrations.PolicyServerMigrations, error) {
	fake.migrationsToPerformMutex.Lock()
	ret, specificReturn := fake.migrationsToPerformReturnsOnCall[len(fake.migrationsToPerformArgsForCall)]
	fake.migrationsToPerformArgsForCall = append(fake.migrationsToPerformArgsForCall, struct {
	}{})
	stub := fake.MigrationsToPerformStub
	fakeReturns := fake.migrationsToPerformReturns
	fake.recordInvocation("MigrationsToPerform", []interface{}{})
	fake.migrationsToPerformMutex.Unlock()
	if stub != nil {
		return stub()
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *MigrationsProvider) MigrationsToPerformCallCount() int {
	fake.migrationsToPerformMutex.RLock()
	defer fake.migrationsToPerformMutex.RUnlock()
	return len(fake.migrationsToPerformArgsForCall)
}

func (fake *MigrationsProvider) MigrationsToPerformCalls(stub func() (migrations.PolicyServerMigrations, error)) {
	fake.migrationsToPerformMutex.Lock()
	defer fake.migrationsToPerformMutex.Unlock()
	fake.MigrationsToPerformStub = stub
}

func (fake *MigrationsProvider) MigrationsToPerformReturns(result1 migrations.PolicyServerMigrations, result2 error) {
	fake.migrationsToPerformMutex.Lock()
	defer fake.migrationsToPerformMutex.Unlock()
	fake.MigrationsToPerformStub = nil
	fake.migrationsToPerformReturns = struct {
		result1 migrations.PolicyServerMigrations
		result2 error
	}{result1, result2}
}

func (fake *MigrationsProvider) MigrationsToPerformReturnsOnCall(i int, result1 migrations.PolicyServerMigrations, result2 error) {
	fake.migrationsToPerformMutex.Lock()
	defer fake.migrationsToPerformMutex.Unlock()
	fake.MigrationsToPerformStub = nil
	if fake.migrationsToPerformReturnsOnCall == nil {
		fake.migrationsToPerformReturnsOnCall = make(map[int]struct {
			result1 migrations.PolicyServerMigrations
			result2 error
		})
	}
	fake.migrationsToPerformReturnsOnCall[i] = struct {
		result1 migrations.PolicyServerMigrations
		result2 error
	}{result1, result2}
}

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

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