
import Interface4Background from "./Interface4Background";
import BackgroundService from "../domain/BackgroundService";
import TabScript from "../domain/TabScript";
import Comment from "../domain/Comment";
import State from "../domain/State";
import RuleService from "../domain/RuleService";
import Interface4ViewManager from "./Interface4ViewManager";
import ActionProbabilityMap from "../domain/ActionProbabilityMap";
import ViewManagerService from "../domain/ViewManagerService";
import ExplorationEvaluation from "../domain/ExplorationEvaluation";
import Question from "../../background/domain/Question";
import EvaluationActionsBorderView from "../_ui/EvaluationActionsBorderView";

export default class TabScriptService implements Interface4Background, Interface4ViewManager {
    private _tabScript : TabScript;

    constructor(backgroundService : BackgroundService, shadowMode : boolean = false) {
        this._tabScript = new TabScript(backgroundService, shadowMode);    
    }

    synchronizeWithBackground() : Promise<void> {
        return this._tabScript.synchronizeWithBackground();
    }

    linkToViewManager(viewManager : ViewManagerService) {
        this._tabScript.linkToViewManager(viewManager);
    }
    

    getRuleService() : RuleService {
        return this._tabScript.getRuleService();
    }

    explorationStarted() {
        this._tabScript.explorationStarted();
    }

    explorationStopped() {
        this._tabScript.explorationStopped();
    }

    reload() {
        this._tabScript.reload();
    }


    getState(): Promise<State> {
        return this._tabScript.getState();
    }

    getCommentList(): Promise<Comment[]> {
        return this._tabScript.getCommentList();
    }

    getProbabilityMap(): Promise<ActionProbabilityMap> {
        return this._tabScript.getProbabilityMap();
    }

    getExplorationEvaluation(): Promise<ExplorationEvaluation | null> {
        return this._tabScript.getExplorationEvaluation()
    }

    commentConfirmed(comment: Comment) {
        this._tabScript.commentConfirmed(comment);
    }

    setUserViewPosition(newPosition : {x : number, y: number}) {
        this._tabScript.setUserViewPosition(newPosition);
    }

    pushAnswer(question: Question, value: boolean) {
        this._tabScript.pushAnswer(question, value);
    }

}