package ui

import (
	"go_dreamfactory/cmd/v2/service/observer"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/container"
)

type toys struct {
	widget *fyne.Container
}

func newToys(obs observer.Observer) *toys {
	var t toys

	cards := make([]fyne.CanvasObject, len(toyRegister))
	for i, toy := range toyRegister {
		toy := toy
		err := toy.Init(obs)
		if err != nil {
			panic(err)
		}

		cards[i] = toy.GetToyCard()
	}

	t.widget = container.New(NewVCZBoxLayout(),
		cards...)
	return &t
}
