import { QuestEngine } from "../../engine/questEngine";
import { QuestItem } from "../../engine/questItem";

declare const RF;


// RF.registerComponent({
//     name: 'app-button',
//     template: `
    
//     <div class="butt">
//         button here: {{text}}
//     </div>
    
//     `,
//     text: '',
//     click:()=>{},
//     arg:null
// })

@RF.decorateComponent({
    template: require('./questComponent.html'),
    name: 'app-quest'
})
export class QuestComponent {

    questEngine:QuestEngine = new QuestEngine();

    constructor(){
        (window as any).q = this.questEngine;
    }

    resolveClick(q) {
        this.questEngine.resolveAction(q);
    }

    getLabel(){
        let target:any = this.questEngine.questItem.label;
        if (target.call) return (target as Function)(this.questEngine);
        return target;
    }

    getQuestions(){
        let target:any = this.questEngine.questItem.questions
        if (target.call) return (target as Function)(this.questEngine);
        return target;
    }

    applyInventory(inv) {
        this.questEngine.applyInventory(inv);
    }

    
} 