/*
 * Runtime Web – Unified Serverless Framework for Full-Stack TypeScript Applications
 * Documentation: https://runtimeweb.com/docs/getting-started
 *
 * @template: ai
 */

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

/**
 * Minimal home page component for the AI chat application.
 * Extend this with your chat UI components.
 */
const HomePage: React.FC = () => {
    return (
        <div style={{ padding: '2rem', maxWidth: '800px', margin: '0 auto' }}>
            <h1>AI Chat Application</h1>
            <p>
                Welcome to your AI chat microservice. This template includes:
            </p>
            <ul>
                <li>AWS Bedrock integration for AI responses</li>
                <li>DynamoDB session memory for conversation history</li>
                <li>OpenSearch vector search for RAG pattern</li>
            </ul>
            <h2>API Endpoint</h2>
            <p>
                Send POST requests to <code>/chat</code> with the following body:
            </p>
            <pre style={{ background: '#f5f5f5', padding: '1rem', borderRadius: '4px' }}>
                {`{
  "sessionId": "unique-session-id",
  "message": "Your message here"
}`}
            </pre>
            <p>
                See the README.md for detailed setup and deployment instructions.
            </p>
        </div>
    );
};

/**
 * Runtime Web 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.
 */
export const routes = [
    {
        path: '/',
        id: 'root',
        Component: () => (
            <>
                <RuntimeHeadManager />
                <Outlet />
            </>
        ),
        children: [
            {
                path: '/',
                id: 'home',
                Component: HomePage,
            },
        ],
    }
];
