"""统一UI展示字典只读接口。"""

from __future__ import annotations

from flask import current_app

from dms.api.v1.blueprint import api_v1
from dms.common.response import success_response
from dms.security.decorators import bearer_auth_required
from dms.services.ui_dictionary_service import UiDictionaryConfig


@api_v1.get("/config/ui-dictionaries")
@bearer_auth_required
def get_ui_dictionaries():
    dictionaries: UiDictionaryConfig = current_app.extensions[
        "dms_ui_dictionaries"
    ]
    response, status = success_response(dictionaries.to_dict())
    response.headers["Cache-Control"] = "private, no-store"
    return response, status
