// import { BJ_Casino_Data } from "./BJ_Casino_Data";
import dayjs from "dayjs";
import { Ref, ref } from "vue";

export class BJ_Casino_BotController {
    //#region Lifecycle

    public Hostport: any[] = ["不選擇環境", "內版", "肉乾", "賴宏", "40", "送審", "外版", "testing1", "testing2", "testing3"];

    public ServerIndedx: number = 6;

    public ServerDefault: Ref<string> = ref(this.Hostport[this.ServerIndedx]);

    //#endregion

    //#region get set

    // public get Host(): string { return this.Host; }
    // public get Port(): string { return this.Port; }

    //#endregion

    //#region Lifecycle

    /**
     *
     */
    constructor() {
        import("dayjs/locale/zh-tw");
        dayjs.locale("zh-tw");
        // this.BJ_Casino = client.BJ_Casino;
        // this.onLoad();
    }

    // public async onLoad() {
    //     await this.SetInit();
    // };

    // public async SetInit() {
    //     while (this.BJ_Casino?.Client.isLoading.value) {
    //         await Tools.Sleep(50);
    //     }
    //     this._client.Title.value = this.BJ_Casino?.Title;
    //     this.SendData();
    // };

    //#endregion

    //#region Custom

    public GetServer(): any {
        let resp: Object = {};
        switch (this.ServerIndedx) {
            // 不選擇環境
            case 0:
            // 外網連內版
            case 1: {
                resp["host"] = "http://220.134.195.1";
                resp["port"] = "19005";
                break;
            }

            // 肉乾
            case 2: {
                resp["host"] = "http://192.168.5.230";
                resp["port"] = "9006";
                break;
            }

            // 賴宏
            case 3: {
                resp["host"] = "http://192.168.5.134";
                resp["port"] = "9005";
                break;
            }

            // 40
            case 4: {
                resp["host"] = "http://192.168.5.12";
                resp["port"] = "9487";
                break;
            }

            // 送審
            case 5: {
                resp["host"] = "https://submit.online-bj.com";
                resp["port"] = "9005";
                break;
            }

            // 外版
            case 6: {
                resp["host"] = "https://game.online-bj.com";
                resp["port"] = "9005";
                break;
            }

            // testing1
            case 7: {
                resp["host"] = "http://bj-testing1.casino.catan.com.tw";
                resp["port"] = "9005";
                break;
            }

            // testing2
            case 8: {
                resp["host"] = "http://bj-testing2.casino.catan.com.tw";
                resp["port"] = "9005";
                break;
            }

            // testing3
            case 9: {
                resp["host"] = "http://bj-testing3.casino.catan.com.tw";
                resp["port"] = "9005";
                break;
            }

            default: {
                break;
            }
        }
        return resp;
    }

    public SelectServer(data: number): void {
        this.ServerIndedx = data;
    }

    //#endregion
}
