from flask import Blueprint
from app.controllers import HistoryController
from app.di_container import Container
from dependency_injector.wiring import inject, Provide

history_blueprint = Blueprint("history", __name__)


@history_blueprint.route("/<user_id>", methods=["GET"])
@inject
def user_history(
    user_id: str, controller: HistoryController = Provide[Container.history_controller]
):
    return controller.get_quiz_by_user(user_id)


@history_blueprint.route("/detail/<answer_id>", methods=["GET"])
@inject
def user_detail_history(
    answer_id, controller: HistoryController = Provide[Container.history_controller]
):
    return controller.get_detail_quiz_history(answer_id)
