from flask import Blueprint, redirect, url_for
from flask_login import login_required

from app.utils import require_perm


pm_dashboard_bp = Blueprint(
    "pm_dashboard",
    __name__,
    url_prefix="/pm-dashboard",
    template_folder="../templates",
)


@pm_dashboard_bp.route("/")
@login_required
@require_perm("operations.kpi.dashboard.view")
def dashboard():
    """
    PM landing page.

    The legacy PM dashboard has been retired.  Keep this endpoint so existing
    menu links, bookmarks and user landing-page selections remain valid, and
    send users to the single PM KPI dashboard/calculation engine.
    """
    return redirect(url_for("operations.pm_kpi_dashboard"))
