package domaintest

import (
	"gitea.dwysokinski.me/twhelp/corev3/internal/domain"
	"github.com/brianvoe/gofakeit/v6"
	"github.com/stretchr/testify/require"
)

type OpponentsDefeatedConfig struct {
	ScoreAtt int
}

func NewOpponentsDefeated(tb TestingTB, opts ...func(cfg *OpponentsDefeatedConfig)) domain.OpponentsDefeated {
	tb.Helper()

	cfg := &OpponentsDefeatedConfig{
		ScoreAtt: gofakeit.IntRange(100000, 1000000),
	}

	for _, opt := range opts {
		opt(cfg)
	}

	od, err := domain.NewOpponentsDefeated(
		gofakeit.IntRange(1, 100),
		cfg.ScoreAtt,
		gofakeit.IntRange(1, 100),
		gofakeit.IntRange(100000, 1000000),
		gofakeit.IntRange(1, 100),
		gofakeit.IntRange(100000, 1000000),
		gofakeit.IntRange(1, 100),
		gofakeit.IntRange(100000, 1000000),
	)
	require.NoError(tb, err)

	return od
}
