import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';

const cliCommands = [
  'cli/overview',
  'cli/abap-run',
  'cli/aunit',
  'cli/auth',
  'cli/badi',
  'cli/cds',
  'cli/check',
  'cli/checkin',
  'cli/checkout',
  'cli/cts-transport',
  'cli/datapreview',
  'cli/ddic',
  'cli/discovery',
  'cli/fetch',
  'cli/flp',
  'cli/function',
  'cli/gcts',
  'cli/get',
  'cli/import',
  'cli/info',
  'cli/lock',
  'cli/ls',
  'cli/objects',
  'cli/package',
  'cli/rap',
  'cli/repl',
  'cli/rfc',
  'cli/search',
  'cli/source',
  'cli/strust',
  'cli/user',
  'cli/wb',
];

const mcpTools = [
  'mcp/tools/activate_object',
  'mcp/tools/activate_package',
  'mcp/tools/atc_run',
  'mcp/tools/call_rfc',
  'mcp/tools/changeset_add',
  'mcp/tools/changeset_begin',
  'mcp/tools/changeset_commit',
  'mcp/tools/changeset_rollback',
  'mcp/tools/check_syntax',
  'mcp/tools/checkin',
  'mcp/tools/clone_object',
  'mcp/tools/create_badi',
  'mcp/tools/create_bdef',
  'mcp/tools/create_function_group',
  'mcp/tools/create_function_module',
  'mcp/tools/create_object',
  'mcp/tools/create_package',
  'mcp/tools/create_srvb',
  'mcp/tools/create_srvd',
  'mcp/tools/cts_create_task',
  'mcp/tools/cts_create_transport',
  'mcp/tools/cts_delete_transport',
  'mcp/tools/cts_get_transport',
  'mcp/tools/cts_list_transports',
  'mcp/tools/cts_reassign_transport',
  'mcp/tools/cts_release_transport',
  'mcp/tools/cts_search_transports',
  'mcp/tools/cts_update_transport',
  'mcp/tools/delete_badi',
  'mcp/tools/delete_bdef',
  'mcp/tools/delete_cert',
  'mcp/tools/delete_function_module',
  'mcp/tools/delete_object',
  'mcp/tools/delete_srvb',
  'mcp/tools/delete_srvd',
  'mcp/tools/discovery',
  'mcp/tools/find_definition',
  'mcp/tools/find_references',
  'mcp/tools/gcts_checkout_branch',
  'mcp/tools/gcts_clone_repo',
  'mcp/tools/gcts_commit',
  'mcp/tools/gcts_config',
  'mcp/tools/gcts_create_branch',
  'mcp/tools/gcts_create_repo',
  'mcp/tools/gcts_delete_repo',
  'mcp/tools/gcts_get_repo',
  'mcp/tools/gcts_list_branches',
  'mcp/tools/gcts_list_repos',
  'mcp/tools/gcts_log',
  'mcp/tools/gcts_pull',
  'mcp/tools/gcts_switch_branch',
  'mcp/tools/get_badi',
  'mcp/tools/get_bdef',
  'mcp/tools/get_callees_of',
  'mcp/tools/get_callers_of',
  'mcp/tools/get_cds_dcl',
  'mcp/tools/get_cds_ddl',
  'mcp/tools/get_data_element',
  'mcp/tools/get_domain',
  'mcp/tools/get_features',
  'mcp/tools/get_flp_tile',
  'mcp/tools/get_function',
  'mcp/tools/get_function_group',
  'mcp/tools/get_git_types',
  'mcp/tools/get_include',
  'mcp/tools/get_installed_components',
  'mcp/tools/get_object',
  'mcp/tools/get_object_structure',
  'mcp/tools/get_package',
  'mcp/tools/get_source',
  'mcp/tools/get_srvb',
  'mcp/tools/get_srvd',
  'mcp/tools/get_structure',
  'mcp/tools/get_table',
  'mcp/tools/get_table_contents',
  'mcp/tools/get_test_classes',
  'mcp/tools/get_type_hierarchy',
  'mcp/tools/git_export',
  'mcp/tools/grep_objects',
  'mcp/tools/grep_packages',
  'mcp/tools/import_object',
  'mcp/tools/import_package',
  'mcp/tools/import_transport',
  'mcp/tools/list_certs',
  'mcp/tools/list_flp_catalogs',
  'mcp/tools/list_flp_groups',
  'mcp/tools/list_flp_tiles',
  'mcp/tools/list_package_objects',
  'mcp/tools/list_pses',
  'mcp/tools/lock_object',
  'mcp/tools/lookup_user',
  'mcp/tools/pretty_print',
  'mcp/tools/publish_service_binding',
  'mcp/tools/run_abap',
  'mcp/tools/run_query',
  'mcp/tools/run_unit_tests',
  'mcp/tools/sap_connect',
  'mcp/tools/sap_disconnect',
  'mcp/tools/search_objects',
  'mcp/tools/stat_package',
  'mcp/tools/system_info',
  'mcp/tools/unlock_object',
  'mcp/tools/unpublish_srvb',
  'mcp/tools/update_source',
  'mcp/tools/upload_cert',
  'mcp/tools/list_source_versions',
  'mcp/tools/get_short_dumps',
  'mcp/tools/get_completions',
  'mcp/tools/cts_transport_source_manifest',
  'mcp/tools/cts_transport_objects',
  'mcp/tools/get_frozen_source',
  'mcp/tools/get_source_version',
  'mcp/tools/get_context',
  'mcp/tools/lint_abap',
  'mcp/tools/get_traces',
];

const sdkPackages = [
  'sdk/packages/overview',
  'sdk/packages/abap-ast',
  'sdk/packages/acds',
  'sdk/packages/aclass',
  'sdk/packages/adk',
  'sdk/packages/adt-atc',
  'sdk/packages/adt-aunit',
  'sdk/packages/adt-auth',
  'sdk/packages/adt-cli',
  'sdk/packages/adt-client',
  'sdk/packages/adt-codegen',
  'sdk/packages/adt-config',
  'sdk/packages/adt-contracts',
  'sdk/packages/adt-diff',
  'sdk/packages/adt-export',
  'sdk/packages/adt-fixtures',
  'sdk/packages/adt-lint',
  'sdk/packages/adt-locks',
  'sdk/packages/adt-mcp',
  'sdk/packages/adt-pilot',
  'sdk/packages/adt-playwright',
  'sdk/packages/adt-plugin',
  'sdk/packages/adt-plugin-abapgit',
  'sdk/packages/adt-plugin-gcts',
  'sdk/packages/adt-plugin-gcts-cli',
  'sdk/packages/adt-proxy',
  'sdk/packages/adt-puppeteer',
  'sdk/packages/adt-rfc',
  'sdk/packages/adt-schemas',
  'sdk/packages/adt-server',
  'sdk/packages/adt-server-client',
  'sdk/packages/adt-tui',
  'sdk/packages/asjson-parser',
  'sdk/packages/browser-auth',
  'sdk/packages/logger',
  'sdk/packages/openai-codegen',
  'sdk/packages/speci',
  'sdk/packages/ts-xsd',
];

const sdkContracts = [
  'sdk/contracts/overview',
  'sdk/contracts/discovery',
  'sdk/contracts/core-http',
  'sdk/contracts/cts',
  'sdk/contracts/atc',
  'sdk/contracts/aunit',
  'sdk/contracts/oo',
  'sdk/contracts/packages',
  'sdk/contracts/programs',
  'sdk/contracts/ddic',
  'sdk/contracts/functions',
  'sdk/contracts/system',
  'sdk/contracts/repository',
  'sdk/contracts/bo',
  'sdk/contracts/businessservices',
  'sdk/contracts/datapreview',
  'sdk/contracts/checkruns',
  'sdk/contracts/activation',
  'sdk/contracts/runtime-traces',
  'sdk/contracts/gcts',
  'sdk/contracts/uifsa',
  'sdk/contracts/enhancements',
];

const sidebars: SidebarsConfig = {
  docs: [
    'index',
    {
      type: 'category',
      label: 'Getting Started',
      link: { type: 'doc', id: 'getting-started/installation' },
      items: [
        'getting-started/installation',
        'getting-started/auth',
        'getting-started/first-commands',
        'getting-started/mcp-setup',
        'getting-started/quick-tour',
      ],
    },
    {
      type: 'category',
      label: 'CLI',
      link: { type: 'generated-index' },
      items: cliCommands,
    },
    {
      type: 'category',
      label: 'Guides',
      link: { type: 'doc', id: 'guides/overview' },
      items: [
        'guides/cts-workflow',
        'guides/object-lifecycle',
        'guides/ddic-modeling',
        'guides/cds-authoring',
        'guides/rap-development',
        'guides/aunit-with-coverage',
        'guides/abapgit-checkout-checkin',
        'guides/gcts-workflow',
        'guides/format-comparison',
        'guides/workbench-navigation',
        'guides/ci-pipeline',
        'guides/rfc-automation',
        'guides/mock-server',
      ],
    },
    {
      type: 'category',
      label: 'MCP',
      link: { type: 'generated-index' },
      items: [
        'mcp/overview',
        {
          type: 'category',
          label: 'Tools',
          link: { type: 'generated-index' },
          items: mcpTools,
        },
      ],
    },
    {
      type: 'category',
      label: 'SDK',
      link: { type: 'generated-index' },
      items: [
        {
          type: 'category',
          label: 'Packages',
          link: { type: 'generated-index' },
          items: sdkPackages,
        },
        {
          type: 'category',
          label: 'Contracts',
          link: { type: 'generated-index' },
          items: sdkContracts,
        },
      ],
    },
    {
      type: 'category',
      label: 'Plugins',
      link: { type: 'doc', id: 'plugins/overview' },
      items: [
        {
          type: 'category',
          label: 'Format',
          items: ['plugins/abapgit-format', 'plugins/gcts-format'],
        },
        {
          type: 'category',
          label: 'Commands',
          items: [
            'plugins/gcts-cli',
            'plugins/aunit',
            'plugins/atc',
            'plugins/abapgit-plugin',
          ],
        },
        {
          type: 'category',
          label: 'Writing plugins',
          items: [
            'plugins/writing-command-plugin',
            'plugins/writing-format-plugin',
          ],
        },
      ],
    },
    {
      type: 'category',
      label: 'Architecture',
      link: { type: 'doc', id: 'architecture/overview' },
      items: [
        'architecture/overview',
        'architecture/contracts-pipeline',
        'architecture/adk',
        'architecture/format-plugins',
        'architecture/mock-server',
        'architecture/real-e2e',
        'architecture/coverage',
        'architecture/checkin-batch-lock',
      ],
    },
    {
      type: 'category',
      label: 'Roadmap',
      link: { type: 'doc', id: 'project-roadmap/overview' },
      items: ['project-roadmap/overview', 'project-roadmap/future'],
    },
    {
      type: 'category',
      label: 'Contributing',
      link: { type: 'generated-index' },
      items: ['contributing/overview'],
    },
  ],
};

export default sidebars;
