/*
 * Elastic License 2.0
 * Copyright (C) 2025–present Raman Marozau, Work Target Insight Function. All rights reserved.
 * Contact: raman@worktif.com
 *
 * This file is part of the Licensed Work: worktif.runtime.cdk <worktif_runtime_cdk>.
 * Use of this software is governed by the Elastic License 2.0; see the LICENSE file
 * or https://www.elastic.co/licensing/elastic-license for details.
 *
 * Re-licensing notice:
 *   This file was previously distributed under the Business Source License 1.1 (BUSL-1.1).
 *   As of 2025-09-22, it is re-licensed under Elastic License 2.0.
 *
 * SPDX-License-Identifier: Elastic-2.0
 */

import * as React from 'react';
import { Outlet } from 'react-router';
import { RuntimeHeadManager } from '@worktif/runtime';

import HomePage from './pages/HomePage';
import AboutPage from './pages/AboutPage';
import UsersPage from './pages/UsersPage';

/**
 * Runtime routes definition for React Router v7.
 *
 * The root route provides a shared layout that mounts the RuntimeHeadManager
 * above the Outlet so SEO metadata are managed centrally for all child routes.
 * Paths are constructed via Runtime's routePath helper to keep URLs consistent
 * across different deployment stages (dev, staging, prod).
 */
export const routes = [
  {
    path: '/',
    id: 'root',
    Component: () => (
      <>
        <RuntimeHeadManager/>
        <Outlet/>
      </>
    ),
    children: [
      {
        path: '/',
        id: 'home',
        Component: HomePage,
      },
      {
        path: '/about',
        id: 'about',
        Component: AboutPage,
      },
      {
        id: '3',
        path: '/users',
        element: <UsersPage/>
      },
    ],
  },
];
