import SceneMediator from "olympus-r/engine/scene/SceneMediator";
import { DOMMediatorClass } from "olympus-r-dom/dom/injector/Injector";
import { BindOn, BindValue, SubMediator } from "olympus-r/engine/injector/Injector";
import { panelManager } from "olympus-r/engine/panel/PanelManager";
import { moduleManager } from "olympus-r/engine/module/ModuleManager";
import { ITopBarScene, DOMTopBar } from "../../component/Topbar";

@DOMMediatorClass("Second", "./src/module/Second/Second.html")
export default class Second extends SceneMediator implements ITopBarScene
{
    @SubMediator
    private _topBar:DOMTopBar;

    public topBarText:string = "次首页";

    @BindValue("textContent", "'这是第二个模块'")
    private text:HTMLDivElement;
    @BindOn("click", function(){
        panelManager.confirm(
            "回到首页？",
            ()=>moduleManager.close(Second)
        );
    })
    private btn:HTMLDivElement;

    /**
     * 这个方法返回模块依赖的HTML模板文件路径
     * 
     * @returns {string[]} 
     * @memberof Second
     */
    public listAssets():string[]
    {
        return ["./src/module/Second/Second.html"];
    }

    /**
     * 这个方法返回模块依赖的样式文件
     * 
     * @returns {string[]} 
     * @memberof Second
     */
    public listStyleFiles():string[]
    {
        return ["./src/module/Second/Second.css"];
    }
}