package mockapp

import (
	"context"
	"sync"
	"wartank/pkg/mock/mockkernel"
	"wartank/pkg/types"
)

type MockApp struct {
	*mockkernel.MockKernel
	fnCancel func()
	ctx      context.Context
	bot      types.IWarBot
	store    types.IStore
	block    *sync.RWMutex
}

func NewMockApp() *MockApp {
	ctxBg := context.Background()
	ctx, fnCancel := context.WithCancel(ctxBg)
	sf := &MockApp{
		MockKernel: mockkernel.NewMockKernel(),
		ctx:        ctx,
		fnCancel:   fnCancel,
		block:      &sync.RWMutex{},
	}
	return sf
}

func (sf *MockApp) Store() types.IStore {
	return sf.store
}

func (sf *MockApp) Bot() types.IWarBot {
	return sf.bot
}

func (sf *MockApp) Angar() types.IAngar {
	return nil
}

func (sf *MockApp) CtxApp() context.Context {
	return sf.ctx
}

func (sf *MockApp) Tank() types.ITank {
	return nil
}

func (sf *MockApp) Run() error {
	return nil
}

func (sf *MockApp) CancelApp() {
	go sf.fnCancel()
}

func (sf *MockApp) Block() *sync.RWMutex {
	return sf.block
}

func (sf *MockApp) NetClient() types.IBotNet {
	return nil
}

func (sf *MockApp) ServBots() types.IServBots {
	return nil
}
