package cn.forevermc.launcher.bean;

import cn.forevermc.launcher.ctrl.pane.About;
import cn.forevermc.launcher.ctrl.pane.CanvasProgress;
import cn.forevermc.launcher.ctrl.pane.Dialog;
import cn.forevermc.launcher.ctrl.pane.GameOption;
import cn.forevermc.launcher.ctrl.pane.GameSelect;
import cn.forevermc.launcher.ctrl.pane.LangSelect;
import cn.forevermc.launcher.ctrl.pane.Launching;
import cn.forevermc.launcher.ctrl.pane.Menu;
import cn.forevermc.launcher.ctrl.pane.Option;
import cn.forevermc.launcher.ctrl.pane.OriginalSelect;
import cn.forevermc.launcher.ctrl.pane.PackSelect;
import cn.forevermc.launcher.ctrl.pane.PlayerSelect;
import cn.forevermc.launcher.ctrl.pane.ResourceDownload;
import cn.forevermc.launcher.view.components.AbstractPane;
import com.imyeyu.inject.TimiInject;
import com.imyeyu.inject.annotation.Inject;
import com.imyeyu.inject.annotation.StaticInject;

/**
 * 页面
 *
 * @author 夜雨
 * @since 2022-11-21 16:38
 */
@StaticInject
public enum Page {

	/** 会话 */
	DIALOG(Dialog.class),

	/** 画板进度 */
	CANVAS_PROGRESS(CanvasProgress.class),

	/** 菜单 */
	MENU(Menu.class),

	/** 选项 */
	OPTION(Option.class),

	/** 原版下载 */
	ORIGINAL_SELECT(OriginalSelect.class),

	/** 整合版选择 */
	PACK_SELECT(PackSelect.class),

	/** 版本配置 */
	PACK_OPTION(GameOption.class),

	/** 启动版本选择 */
	GAME_SELECT(GameSelect.class),

	/** 玩家选择 */
	PLAYER_SELECT(PlayerSelect.class),

	/** 资源下载 */
	RESOURCE_DOWNLOAD(ResourceDownload.class),

	/** 启动过渡页 */
	LAUNCHING(Launching.class),

	/** 语言选择 */
	LANG_SELECT(LangSelect.class),

	/** 关于 */
	ABOUT(About.class);

	@Inject
	private static TimiInject injector;

	/** 页面类 */
	final Class<? extends AbstractPane> page;

	Page(Class<? extends AbstractPane> page) {
		this.page = page;
	}

	/** @return 页面类 */
	public Class<?> getClazz() {
		return page;
	}

	/** @return 从 TimiInject 控制反转对象获取该页面 */
	public AbstractPane getIOCPage() {
		return injector.di(page);
	}
}
