package fix

import (
	"sync"

	"github.com/stretchr/testify/mock"

	"quantex.com/qfixdpl/src/domain"
)

// MockPersistenceStore is a testify mock implementing domain.PersistenceStore.
type MockPersistenceStore struct {
	mock.Mock
}

func (m *MockPersistenceStore) SaveMessage(msg domain.TradeMessage) error {
	args := m.Called(msg)
	return args.Error(0)
}

func (m *MockPersistenceStore) SaveLog(entry domain.LogEntry) error {
	args := m.Called(entry)
	return args.Error(0)
}

func (m *MockPersistenceStore) GetTodayMessages() ([]domain.TradeMessage, error) {
	args := m.Called()
	msgs, _ := args.Get(0).([]domain.TradeMessage)
	return msgs, args.Error(1)
}

func (m *MockPersistenceStore) GetLogsByQuoteReqID(quoteReqID string) (domain.Logs, error) {
	args := m.Called(quoteReqID)
	logs, _ := args.Get(0).(domain.Logs)
	return logs, args.Error(1)
}

func (m *MockPersistenceStore) UpdateLogTradeID(quoteReqID, tradeID string) error {
	args := m.Called(quoteReqID, tradeID)
	return args.Error(0)
}

func (m *MockPersistenceStore) GetFullTradeLog(quoteReqID string) (domain.FullTradeLog, error) {
	args := m.Called(quoteReqID)
	log, _ := args.Get(0).(domain.FullTradeLog)
	return log, args.Error(1)
}

// MockNotifier is a testify mock implementing domain.Notifier.
type MockNotifier struct {
	mock.Mock
}

func (m *MockNotifier) SendMsg(chat domain.MessageChannel, text string, status domain.MessageStatus, wg *sync.WaitGroup) {
	m.Called(chat, text, status, wg)
}
