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

import (
	"context"
	"sync"

	"code.cloudfoundry.org/eirini/bifrost"
)

type FakeJSONClient struct {
	PostStub        func(context.Context, string, interface{}) error
	postMutex       sync.RWMutex
	postArgsForCall []struct {
		arg1 context.Context
		arg2 string
		arg3 interface{}
	}
	postReturns struct {
		result1 error
	}
	postReturnsOnCall map[int]struct {
		result1 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeJSONClient) Post(arg1 context.Context, arg2 string, arg3 interface{}) error {
	fake.postMutex.Lock()
	ret, specificReturn := fake.postReturnsOnCall[len(fake.postArgsForCall)]
	fake.postArgsForCall = append(fake.postArgsForCall, struct {
		arg1 context.Context
		arg2 string
		arg3 interface{}
	}{arg1, arg2, arg3})
	stub := fake.PostStub
	fakeReturns := fake.postReturns
	fake.recordInvocation("Post", []interface{}{arg1, arg2, arg3})
	fake.postMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakeJSONClient) PostCallCount() int {
	fake.postMutex.RLock()
	defer fake.postMutex.RUnlock()
	return len(fake.postArgsForCall)
}

func (fake *FakeJSONClient) PostCalls(stub func(context.Context, string, interface{}) error) {
	fake.postMutex.Lock()
	defer fake.postMutex.Unlock()
	fake.PostStub = stub
}

func (fake *FakeJSONClient) PostArgsForCall(i int) (context.Context, string, interface{}) {
	fake.postMutex.RLock()
	defer fake.postMutex.RUnlock()
	argsForCall := fake.postArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}

func (fake *FakeJSONClient) PostReturns(result1 error) {
	fake.postMutex.Lock()
	defer fake.postMutex.Unlock()
	fake.PostStub = nil
	fake.postReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeJSONClient) PostReturnsOnCall(i int, result1 error) {
	fake.postMutex.Lock()
	defer fake.postMutex.Unlock()
	fake.PostStub = nil
	if fake.postReturnsOnCall == nil {
		fake.postReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.postReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

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

func (fake *FakeJSONClient) 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 _ bifrost.JSONClient = new(FakeJSONClient)
