
import Interface4ViewManager from "../application/Interface4ViewManager";
import ActionProbabilityView from "../_ui/ActionProbabilityView";
import ActionsPopupView from "../_ui/ActionsPopupView";
import EvaluationActionsBorderView from "../_ui/EvaluationActionsBorderView";
import UserView from "../_ui/UserView";
import ActionState from "./ActionState";
import Comment from "./Comment";
import ExplorationEvaluation from "./ExplorationEvaluation";
import State from "./State";


export default class StyleManager {
    private _actionProbabilityView : ActionProbabilityView;
    private _actionPopupView : ActionsPopupView;
    private _userView : UserView;
    private _evaluationActionsBorderView: EvaluationActionsBorderView;

    constructor(application: Interface4ViewManager) {
        this._actionPopupView = new ActionsPopupView();
        this._actionProbabilityView = new ActionProbabilityView();
        this._userView = new UserView(application);
        this._evaluationActionsBorderView = new EvaluationActionsBorderView();
    }

    refresh(state: State, elementListMatchedByRule: Element[],actionState: ActionState, evaluation: ExplorationEvaluation, commentList: Comment[]): void {
        this._actionProbabilityView.show(actionState, elementListMatchedByRule);
        this._actionPopupView.show(actionState);
        this._evaluationActionsBorderView.show(evaluation)
        if (state.displayUserView) {
            this._userView.show(commentList, state.confirmedComments, evaluation, state.userTabPosition);
        } else {
            this._userView.hide();
        }
    }

    hide(): Promise<void> {
        this._actionPopupView.hide();
        this._actionProbabilityView.hide();
        this._userView.hide();
        return Promise.resolve();
    }
}
