/**
 * Measuring-tools plugin routes.
 *
 * Every route carries meta.plugin = 'measuringtools' so the ADR-009 router
 * guard redirects to the dashboard when the backend plugin is disabled. List
 * and detail are public (no requiresAuth, matching the other asset types); the
 * form requires auth; the settings subtype page requires admin.
 */
export default [
  {
    path: 'measuringtools',
    name: 'measuringtools',
    component: () => import('./views/MeasuringToolsList.vue'),
    meta: { plugin: 'measuringtools' }
  },
  {
    path: 'measuringtools/new',
    name: 'measuringtool-new',
    component: () => import('./views/MeasuringToolForm.vue'),
    meta: { requiresAuth: true, plugin: 'measuringtools' }
  },
  {
    // Resolve a tool from its core asset id (search rows / cross-links carry
    // assetid, not the extension id). Shares the detail component.
    path: 'measuringtools/by-asset/:assetid',
    name: 'measuringtool-by-asset',
    component: () => import('./views/MeasuringToolDetail.vue'),
    meta: { plugin: 'measuringtools' }
  },
  {
    path: 'measuringtools/:id',
    name: 'measuringtool-detail',
    component: () => import('./views/MeasuringToolDetail.vue'),
    meta: { plugin: 'measuringtools' }
  },
  {
    path: 'measuringtools/:id/edit',
    name: 'measuringtool-edit',
    component: () => import('./views/MeasuringToolForm.vue'),
    meta: { requiresAuth: true, plugin: 'measuringtools' }
  },
  {
    path: 'reports/calibration',
    name: 'calibration-report',
    component: () => import('./views/CalibrationReport.vue'),
    meta: { plugin: 'measuringtools' }
  },
  {
    path: 'settings/measuringtooltypes',
    name: 'measuringtooltypes',
    component: () => import('./views/MeasuringToolTypesList.vue'),
    meta: { requiresAuth: true, requiresAdmin: true, plugin: 'measuringtools' }
  }
]

// No full-screen routes: every view in this plugin renders inside
// AppLayout. Declared so routes.gen.js can read `.toplevel` off the module
// without Rollup warning about a missing export.
export const toplevel = []
