package initcmd

import (
	"sunhpc/internal/middler/auth"

	"sunhpc/pkg/wizard"

	"github.com/spf13/cobra"
)

func NewInitTuiCmd() *cobra.Command {
	var force bool

	cmd := &cobra.Command{
		Use:   "tui",
		Short: "初始化TUI",
		Long: `初始化SunHPC TUI,创建所有表结构和默认数据。
    
示例:
  sunhpc init tui         # 初始化TUI
  sunhpc init tui --force # 强制重新初始化`,
		RunE: func(cmd *cobra.Command, args []string) error {
			if err := auth.RequireRoot(); err != nil {
				return err
			}

			return wizard.Run(force)
		},
	}

	cmd.Flags().BoolVarP(&force, "force", "f", false, "强制重新初始化")
	return cmd
}
