package ui

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

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

type appInterface interface {
	LazyInit(service service.PttService, obs observer.Observer) error
	GetTabItem() *container.TabItem
	GetAppName() string
	OpenDefault() string
	GetUI() interface{}
	OnClose() bool
	Icon() fyne.Resource
}

var (
	appRegister = []appInterface{
		&appMonitor{},
		&appTester{},
		// &appAuto{},
	}

	toolRegister = []appInterface{
		// &appWelcome{},
		&appGen{},
		&appPbGen{},
		&appLock{},
		&appTerm{},
		&appPing{},
		&appMgo{},
		&appConfigValid{},
	}
)

type appAdapter struct {
	tabItem *container.TabItem
	ai      []appInterface
}

func (a appAdapter) LazyInit() error {
	panic("implement LazyInit")
}

func (a appAdapter) GetAppName() string {
	panic("implement GetAppName()")
}

func (a appAdapter) GetUI() interface{} {
	panic("implement GetUI()")
}

func (a appAdapter) OpenDefault() string {
	return ""
}

func (a appAdapter) GetTabItem() *container.TabItem {
	return a.tabItem
}

func (a appAdapter) OnClose() bool {
	return true
}

func (a appAdapter) Icon() fyne.Resource {
	return theme.FyneLogo()
}
