from __future__ import annotations from govoplan_core.core.modules import with_documentation_structured_translations from govoplan_resources.backend.german_structured_documentation import GERMAN_STRUCTURED_TRANSLATIONS from govoplan_core.core.access import CAPABILITY_AUTH_PERMISSION_EVALUATOR, CAPABILITY_AUTH_PRINCIPAL_RESOLVER from govoplan_core.core.modules import DocumentationLink, DocumentationTopic, ModuleManifest, PermissionDefinition, RoleTemplate from govoplan_core.core.provider_governance import declared_module_architecture MODULE_ID = "resources" MODULE_NAME = "Resources" MODULE_VERSION = "0.1.20" READ_SCOPE = "resources:workspace:read" WRITE_SCOPE = "resources:workspace:write" ADMIN_SCOPE = "resources:workspace:admin" OPTIONAL_DEPENDENCIES = ( "booking", "assets", "facilities", "calendar", "files", "workflow_engine", ) def _permission(scope: str, label: str, description: str) -> PermissionDefinition: module_id, resource, action = scope.split(":", 2) return PermissionDefinition( scope=scope, label=label, description=description, category="Resources", level="tenant", module_id=module_id, resource=resource, action=action, ) PERMISSIONS = ( _permission(READ_SCOPE, "View resources workspace", "Read resources records, configuration, and workflow context."), _permission(WRITE_SCOPE, "Manage resources workspace", "Create and update resources records and workflow state."), _permission(ADMIN_SCOPE, "Administer resources workspace", "Configure resources policies, templates, and tenant-level administration."), ) ROLE_TEMPLATES = ( RoleTemplate( slug="resources_manager", name="Resources manager", description="Manage resources records and workflow state.", permissions=(READ_SCOPE, WRITE_SCOPE), ), RoleTemplate( slug="resources_viewer", name="Resources viewer", description="Read resources records and workflow context.", permissions=(READ_SCOPE,), ), ) DOCUMENTATION = ( DocumentationTopic( id=f"{MODULE_ID}.module-boundary", title=f"{MODULE_NAME} module boundary", summary="Shared resource inventory for rooms, vehicles, devices, counters, labs, booths, equipment, availability rules, maintenance blocks, capacities, and accessibility metadata.", body=( "This repository is currently a platform module seed. It registers the domain boundary, " "permission surface, role templates, and documentation metadata before runtime APIs, " "database models, migrations, and WebUI routes are introduced." ), layer="available", documentation_types=("admin", "user"), audience=("user", "operator", "module_admin", "product_owner"), translations={ "de": { "title": "Modulgrenze von Resources", "summary": "Gemeinsames Ressourceninventar für Räume, Fahrzeuge, Geräte, Schalter, Labore, Kabinen, Ausstattung, Verfügbarkeitsregeln, Wartungssperren, Kapazitäten und Barrierefreiheitsmetadaten.", "body": "Dieses Repository ist derzeit ein Grundgerüst für ein Plattformmodul. Es registriert die Fachgrenze, Berechtigungsoberfläche, Rollenvorlagen und Dokumentationsmetadaten, bevor Laufzeit-APIs, Datenbankmodelle, Migrationen und WebUI-Routen eingeführt werden.", } }, order=100, related_modules=OPTIONAL_DEPENDENCIES, links=( DocumentationLink( label="Repository domain boundary", href="govoplan-resources/docs/RESOURCES_DOMAIN_BOUNDARY.md", kind="repository", ), ), metadata={ "kind": "reference", "seed": True, "consequence_classes": { "seed_boundary": "Declares ownership and permissions only; no runtime workflow is available yet.", }, "domain_objects": ['resource inventory', 'availability rules', 'capacity and accessibility metadata', 'maintenance blocks', 'resource classification'], "first_slice": "Create the resource catalogue model and expose resource availability metadata for booking and facilities modules.", }, ), ) manifest = ModuleManifest( id=MODULE_ID, name=MODULE_NAME, version=MODULE_VERSION, dependencies=("access",), optional_dependencies=OPTIONAL_DEPENDENCIES, required_capabilities=(CAPABILITY_AUTH_PRINCIPAL_RESOLVER, CAPABILITY_AUTH_PERMISSION_EVALUATOR), permissions=PERMISSIONS, role_templates=ROLE_TEMPLATES, documentation=DOCUMENTATION, architecture=declared_module_architecture( layer="domain_capability", kind="domain", maturity="scaffold", documentation_ref="docs/RESOURCES_DOMAIN_BOUNDARY.md", known_limits=("Resource catalog, allocation, capacity, and reservation are not implemented yet.",), owned_concepts=("resource", "resource capacity", "allocation"), non_owned_concepts=("asset", "function assignment", "booking"), ), ) manifest = with_documentation_structured_translations( manifest, locale="de", translations=GERMAN_STRUCTURED_TRANSLATIONS ) def get_manifest() -> ModuleManifest: return manifest