{
  "id": "admin",
  "version": "1.0.0",
  "description": "Admin area: dashboard + user management (login required, no RBAC yet)",
  "requires": ["auth"],
  "syncLocalesFromEnabledFeatures": true,
  "files": {
    "from": "files"
  },
  "patches": [
    {
      "file": "configs/routes/index.ts",
      "ops": [
        {
          "type": "insertAfter",
          "marker": "// @irwin:routes-imports",
          "content": "import { AdminRoute } from \"./admin\";\n"
        },
        {
          "type": "insertAfter",
          "marker": "// @irwin:after-current-user",
          "content": "    this.path(\"/admin\", AdminRoute.draw());\n"
        }
      ]
    },
    {
      "file": "app/controllers/index.ts",
      "ops": [
        {
          "type": "append",
          "content": "export * from \"./admin\";\n"
        }
      ]
    },
    {
      "file": "app/views/layouts/main/partials/header.pug",
      "ops": [
        {
          "type": "insertAfter",
          "marker": "// @irwin:main-header-nav-admin",
          "content": "\n      - const __adminPerms = currentUser && currentUser.permissions\n      - const __showAdmin = currentUser && (!Array.isArray(__adminPerms) || __adminPerms.some((p) => ['USM::READ', 'RAP::READ', 'AM::READ'].includes(p)))\n      if __showAdmin\n        a.site-nav__link(href=\"/admin\")= t('header.admin')"
        }
      ]
    },
    {
      "file": "configs/locales/en/common.json",
      "ops": [
        {
          "type": "insertAfter",
          "marker": "\"home\": \"Home\",",
          "content": "\n    \"admin\": \"Admin\","
        }
      ]
    }
  ],
  "postInstall": {
    "messages": [
      "Open: GET /admin (after login at /auth)",
      "Seed user: admin@example.com / password123",
      "RBAC: irwin add admin-rbac"
    ]
  }
}
