import Panel from "../../MVC/views/Panel";
export default class Msg extends Panel {

    constructor(){
        super()

    }

    set message(val) {

    }
    set btnTxt(val) {

    }

    start(data) {
        const { msg } = data;
        this.data.message = msg;
        this['msgTxt'].text = `${this.data.message }`

        switch(data.type){
            case 'creditsOut':
                if(this['creditsOutBtn']){
                    this['creditsOutBtn'].visible = true;
                    this['creditsOutBtn'].enabled = true;
                }
                if(this['confirmBtn']){
                    this['confirmBtn'].visible = false;
                    this['confirmBtn'].enabled = false;
                }
            break;
            case 'err':
                if(this['creditsOutBtn']){
                    this['creditsOutBtn'].visible = false;
                    this['creditsOutBtn'].enabled = false;
                }
                if(this['confirmBtn']){
                    this['confirmBtn'].visible = true;
                    this['confirmBtn'].enabled = true;
                }
            break;
            default:
                if(this['creditsOutBtn']){
                    this['creditsOutBtn'].visible = false;
                    this['creditsOutBtn'].enabled = false;
                }
                if(this['confirmBtn']){
                    this['confirmBtn'].visible = true;
                    this['confirmBtn'].enabled = true;
                }
            break;
        }
    }

    protected get creditsOutBtns(): eui.Button[] {
        return [this['creditsOutBtn']]
    }

    protected get closeBtns(): eui.Button[] {
        return [this['closeBtn']]
    }
    
    public get skinKey() { return 'Msg' }
}