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

import (
	"io"
	"sync"

	"code.cloudfoundry.org/lib/serial"
)

type Serializer struct {
	DecodeAllStub        func(io.ReadSeeker, interface{}) error
	decodeAllMutex       sync.RWMutex
	decodeAllArgsForCall []struct {
		arg1 io.ReadSeeker
		arg2 interface{}
	}
	decodeAllReturns struct {
		result1 error
	}
	decodeAllReturnsOnCall map[int]struct {
		result1 error
	}
	EncodeAndOverwriteStub        func(serial.OverwriteableFile, interface{}) error
	encodeAndOverwriteMutex       sync.RWMutex
	encodeAndOverwriteArgsForCall []struct {
		arg1 serial.OverwriteableFile
		arg2 interface{}
	}
	encodeAndOverwriteReturns struct {
		result1 error
	}
	encodeAndOverwriteReturnsOnCall map[int]struct {
		result1 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *Serializer) DecodeAll(arg1 io.ReadSeeker, arg2 interface{}) error {
	fake.decodeAllMutex.Lock()
	ret, specificReturn := fake.decodeAllReturnsOnCall[len(fake.decodeAllArgsForCall)]
	fake.decodeAllArgsForCall = append(fake.decodeAllArgsForCall, struct {
		arg1 io.ReadSeeker
		arg2 interface{}
	}{arg1, arg2})
	stub := fake.DecodeAllStub
	fakeReturns := fake.decodeAllReturns
	fake.recordInvocation("DecodeAll", []interface{}{arg1, arg2})
	fake.decodeAllMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *Serializer) DecodeAllCallCount() int {
	fake.decodeAllMutex.RLock()
	defer fake.decodeAllMutex.RUnlock()
	return len(fake.decodeAllArgsForCall)
}

func (fake *Serializer) DecodeAllCalls(stub func(io.ReadSeeker, interface{}) error) {
	fake.decodeAllMutex.Lock()
	defer fake.decodeAllMutex.Unlock()
	fake.DecodeAllStub = stub
}

func (fake *Serializer) DecodeAllArgsForCall(i int) (io.ReadSeeker, interface{}) {
	fake.decodeAllMutex.RLock()
	defer fake.decodeAllMutex.RUnlock()
	argsForCall := fake.decodeAllArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *Serializer) DecodeAllReturns(result1 error) {
	fake.decodeAllMutex.Lock()
	defer fake.decodeAllMutex.Unlock()
	fake.DecodeAllStub = nil
	fake.decodeAllReturns = struct {
		result1 error
	}{result1}
}

func (fake *Serializer) DecodeAllReturnsOnCall(i int, result1 error) {
	fake.decodeAllMutex.Lock()
	defer fake.decodeAllMutex.Unlock()
	fake.DecodeAllStub = nil
	if fake.decodeAllReturnsOnCall == nil {
		fake.decodeAllReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.decodeAllReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

func (fake *Serializer) EncodeAndOverwrite(arg1 serial.OverwriteableFile, arg2 interface{}) error {
	fake.encodeAndOverwriteMutex.Lock()
	ret, specificReturn := fake.encodeAndOverwriteReturnsOnCall[len(fake.encodeAndOverwriteArgsForCall)]
	fake.encodeAndOverwriteArgsForCall = append(fake.encodeAndOverwriteArgsForCall, struct {
		arg1 serial.OverwriteableFile
		arg2 interface{}
	}{arg1, arg2})
	stub := fake.EncodeAndOverwriteStub
	fakeReturns := fake.encodeAndOverwriteReturns
	fake.recordInvocation("EncodeAndOverwrite", []interface{}{arg1, arg2})
	fake.encodeAndOverwriteMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *Serializer) EncodeAndOverwriteCallCount() int {
	fake.encodeAndOverwriteMutex.RLock()
	defer fake.encodeAndOverwriteMutex.RUnlock()
	return len(fake.encodeAndOverwriteArgsForCall)
}

func (fake *Serializer) EncodeAndOverwriteCalls(stub func(serial.OverwriteableFile, interface{}) error) {
	fake.encodeAndOverwriteMutex.Lock()
	defer fake.encodeAndOverwriteMutex.Unlock()
	fake.EncodeAndOverwriteStub = stub
}

func (fake *Serializer) EncodeAndOverwriteArgsForCall(i int) (serial.OverwriteableFile, interface{}) {
	fake.encodeAndOverwriteMutex.RLock()
	defer fake.encodeAndOverwriteMutex.RUnlock()
	argsForCall := fake.encodeAndOverwriteArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *Serializer) EncodeAndOverwriteReturns(result1 error) {
	fake.encodeAndOverwriteMutex.Lock()
	defer fake.encodeAndOverwriteMutex.Unlock()
	fake.EncodeAndOverwriteStub = nil
	fake.encodeAndOverwriteReturns = struct {
		result1 error
	}{result1}
}

func (fake *Serializer) EncodeAndOverwriteReturnsOnCall(i int, result1 error) {
	fake.encodeAndOverwriteMutex.Lock()
	defer fake.encodeAndOverwriteMutex.Unlock()
	fake.EncodeAndOverwriteStub = nil
	if fake.encodeAndOverwriteReturnsOnCall == nil {
		fake.encodeAndOverwriteReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.encodeAndOverwriteReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

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

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