// This file is automatically generated by the toc-extractor plugin
// Do not edit manually

export interface TocItem {
  id: string
  level: number
  text: string
  children?: TocItem[]
}

export interface FileToc {
  file: string
  path: string
  title: string
  toc: TocItem[]
}

export const tocData: FileToc[] = [
  {
    file: 'index.mdx',
    path: '/',
    title: 'Overview',
    toc: [
      {
        id: 'heading-overview',
        level: 1,
        text: 'Overview',
        children: [
          {
            id: 'heading-features',
            level: 2,
            text: '🌟 Features',
            children: [
              {
                id: 'heading-core-functionality',
                level: 3,
                text: 'Core Functionality',
                children: [],
              },
              {
                id: 'heading-image-processing',
                level: 3,
                text: 'Image Processing',
                children: [],
              },
              {
                id: 'heading-advanced-features',
                level: 3,
                text: 'Advanced Features',
                children: [],
              },
            ],
          },
          {
            id: 'heading-technical-architecture',
            level: 2,
            text: '🏗️ Technical Architecture',
            children: [
              {
                id: 'heading-frontend-tech-stack',
                level: 3,
                text: 'Frontend Tech Stack',
                children: [],
              },
              {
                id: 'heading-build-system',
                level: 3,
                text: 'Build System',
                children: [],
              },
              {
                id: 'heading-storage-architecture',
                level: 3,
                text: 'Storage Architecture',
                children: [],
              },
            ],
          },
          {
            id: 'heading-quick-start',
            level: 2,
            text: '🚀 Quick Start',
            children: [
              {
                id: 'heading-docker-deployment',
                level: 3,
                text: 'Docker Deployment',
                children: [],
              },
            ],
          },
          {
            id: 'heading-configuration-options',
            level: 2,
            text: '⚙️ Configuration Options',
            children: [
              {
                id: 'heading-remote-repository-configuration-repo',
                level: 4,
                text: 'Remote Repository Configuration (`repo`)',
                children: [],
              },
              {
                id: 'heading-storage-configuration-storage',
                level: 4,
                text: 'Storage Configuration (`storage`)',
                children: [],
              },
              {
                id: 'heading-build-options-options',
                level: 4,
                text: 'Build Options (`options`)',
                children: [],
              },
              {
                id: 'heading-performance-configuration-performance',
                level: 4,
                text: 'Performance Configuration (`performance`)',
                children: [],
              },
              {
                id: 'heading-logging-configuration-logging',
                level: 4,
                text: 'Logging Configuration (`logging`)',
                children: [],
              },
            ],
          },
          {
            id: 'heading-cli-commands',
            level: 2,
            text: '📋 CLI Commands',
            children: [
              {
                id: 'heading-build-commands',
                level: 3,
                text: 'Build Commands',
                children: [],
              },
              {
                id: 'heading-development-commands',
                level: 3,
                text: 'Development Commands',
                children: [],
              },
              {
                id: 'heading-notes',
                level: 3,
                text: 'Notes',
                children: [],
              },
            ],
          },
          {
            id: 'heading-advanced-usage',
            level: 2,
            text: '🔧 Advanced Usage',
            children: [
              {
                id: 'heading-custom-storage-provider',
                level: 3,
                text: 'Custom Storage Provider',
                children: [],
              },
              {
                id: 'heading-custom-image-processing',
                level: 3,
                text: 'Custom Image Processing',
                children: [],
              },
            ],
          },
          {
            id: 'heading-license',
            level: 2,
            text: '📄 License',
            children: [],
          },
          {
            id: 'heading-related-links',
            level: 2,
            text: '🔗 Related Links',
            children: [],
          },
        ],
      },
    ],
  },
  {
    file: 'deployment/index.mdx',
    path: '/deployment',
    title: 'Deployment',
    toc: [
      {
        id: 'heading-deployment',
        level: 1,
        text: 'Deployment',
        children: [],
      },
    ],
  },
  {
    file: 'deployment/cloudflare-pages.mdx',
    path: '/deployment/cloudflare-pages',
    title: 'Cloudflare Pages',
    toc: [
      {
        id: 'heading-cloudflare-pages-deployment',
        level: 1,
        text: 'Cloudflare Pages Deployment',
        children: [],
      },
    ],
  },
  {
    file: 'deployment/docker.mdx',
    path: '/deployment/docker',
    title: 'Docker',
    toc: [
      {
        id: 'heading-docker-deployment',
        level: 1,
        text: 'Docker Deployment',
        children: [
          {
            id: 'heading-tldr',
            level: 2,
            text: 'TL;DR',
            children: [],
          },
          {
            id: 'heading-quick-start',
            level: 2,
            text: '🚀 Quick Start',
            children: [
              {
                id: 'heading-prerequisites',
                level: 3,
                text: 'Prerequisites',
                children: [],
              },
              {
                id: 'heading-1-configuration-files',
                level: 3,
                text: '1. Configuration Files',
                children: [],
              },
              {
                id: 'heading-2-dockerfile-setup',
                level: 3,
                text: '2. Dockerfile setup',
                children: [],
              },
              {
                id: 'heading-3-docker-compose-setup',
                level: 3,
                text: '3. Docker Compose Setup',
                children: [],
              },
              {
                id: 'heading-4-building-and-running',
                level: 3,
                text: '4. Building and Running',
                children: [
                  {
                    id: 'heading-option-1-using-docker-compose-recommended',
                    level: 4,
                    text: 'Option 1: Using Docker Compose (Recommended)',
                    children: [],
                  },
                  {
                    id: 'heading-option-2-manual-docker-build',
                    level: 4,
                    text: 'Option 2: Manual Docker Build',
                    children: [],
                  },
                ],
              },
            ],
          },
          {
            id: 'heading-configuration-details',
            level: 2,
            text: '📋 Configuration Details',
            children: [
              {
                id: 'heading-storage-providers',
                level: 3,
                text: 'Storage Providers',
                children: [],
              },
              {
                id: 'heading-performance-tuning',
                level: 3,
                text: 'Performance Tuning',
                children: [],
              },
            ],
          },
        ],
      },
    ],
  },
  {
    file: 'deployment/github-action.mdx',
    path: '/deployment/github-action',
    title: 'Github Action',
    toc: [
      {
        id: 'heading-github-action-deployment',
        level: 1,
        text: 'Github Action Deployment',
        children: [],
      },
    ],
  },
  {
    file: 'deployment/github-pages.mdx',
    path: '/deployment/github-pages',
    title: 'Github Pages',
    toc: [
      {
        id: 'heading-github-pages-deployment',
        level: 1,
        text: 'Github Pages Deployment',
        children: [],
      },
    ],
  },
  {
    file: 'deployment/vercel.mdx',
    path: '/deployment/vercel',
    title: 'Vercel',
    toc: [
      {
        id: 'heading-vercel-deployment',
        level: 1,
        text: 'Vercel Deployment',
        children: [],
      },
    ],
  },
  {
    file: 'docs-site.mdx',
    path: '/docs-site',
    title: 'Docs site',
    toc: [
      {
        id: 'heading-afilmory-docs-site',
        level: 1,
        text: 'Afilmory Docs Site',
        children: [
          {
            id: 'heading-features',
            level: 2,
            text: 'Features',
            children: [],
          },
          {
            id: 'heading-quick-start',
            level: 2,
            text: 'Quick Start',
            children: [
              {
                id: 'heading-development',
                level: 3,
                text: 'Development',
                children: [],
              },
              {
                id: 'heading-building',
                level: 3,
                text: 'Building',
                children: [],
              },
              {
                id: 'heading-preview',
                level: 3,
                text: 'Preview',
                children: [],
              },
            ],
          },
          {
            id: 'heading-project-structure',
            level: 2,
            text: 'Project Structure',
            children: [],
          },
          {
            id: 'heading-writing-documentation',
            level: 2,
            text: 'Writing Documentation',
            children: [
              {
                id: 'heading-file-based-routing',
                level: 3,
                text: 'File-based Routing',
                children: [],
              },
              {
                id: 'heading-mdx-format',
                level: 3,
                text: 'MDX Format',
                children: [],
              },
              {
                id: 'heading-frontmatter',
                level: 3,
                text: 'Frontmatter',
                children: [],
              },
            ],
          },
          {
            id: 'heading-development-guide',
            level: 2,
            text: 'Development Guide',
            children: [
              {
                id: 'heading-adding-new-content',
                level: 3,
                text: 'Adding New Content',
                children: [],
              },
              {
                id: 'heading-custom-components',
                level: 3,
                text: 'Custom Components',
                children: [],
              },
              {
                id: 'heading-styling',
                level: 3,
                text: 'Styling',
                children: [],
              },
              {
                id: 'heading-route-generation-plugin',
                level: 3,
                text: 'Route Generation Plugin',
                children: [],
              },
            ],
          },
          {
            id: 'heading-configuration',
            level: 2,
            text: 'Configuration',
            children: [
              {
                id: 'heading-vite-configuration',
                level: 3,
                text: 'Vite Configuration',
                children: [],
              },
              {
                id: 'heading-supported-languages',
                level: 3,
                text: 'Supported Languages',
                children: [],
              },
            ],
          },
          {
            id: 'heading-deployment',
            level: 2,
            text: 'Deployment',
            children: [],
          },
          {
            id: 'heading-scripts-reference',
            level: 2,
            text: 'Scripts Reference',
            children: [],
          },
          {
            id: 'heading-contributing',
            level: 2,
            text: 'Contributing',
            children: [],
          },
        ],
      },
    ],
  },
  {
    file: 'storage/index.mdx',
    path: '/storage',
    title: 'Storage providers',
    toc: [
      {
        id: 'heading-storage-providers',
        level: 1,
        text: 'Storage Providers',
        children: [
          {
            id: 'heading-supported-providers',
            level: 2,
            text: 'Supported Providers',
            children: [
              {
                id: 'heading-s3-compatible-storage',
                level: 3,
                text: 'S3-Compatible Storage',
                children: [],
              },
              {
                id: 'heading-github-storage',
                level: 3,
                text: 'GitHub Storage',
                children: [],
              },
              {
                id: 'heading-local-file-system',
                level: 3,
                text: 'Local File System',
                children: [],
              },
            ],
          },
          {
            id: 'heading-photo-processing-workflow',
            level: 2,
            text: 'Photo Processing Workflow',
            children: [
              {
                id: 'heading-image-processing-pipeline',
                level: 3,
                text: 'Image Processing Pipeline',
                children: [],
              },
              {
                id: 'heading-storage-organization',
                level: 3,
                text: 'Storage Organization',
                children: [],
              },
              {
                id: 'heading-processing-commands',
                level: 3,
                text: 'Processing Commands',
                children: [],
              },
            ],
          },
          {
            id: 'heading-environment-specific-configurations',
            level: 2,
            text: 'Environment-Specific Configurations',
            children: [
              {
                id: 'heading-development-setup',
                level: 3,
                text: 'Development Setup',
                children: [],
              },
              {
                id: 'heading-production-setup',
                level: 3,
                text: 'Production Setup',
                children: [],
              },
            ],
          },
          {
            id: 'heading-api-limitations',
            level: 2,
            text: 'API Limitations',
            children: [
              {
                id: 'heading-github-storage-limits',
                level: 3,
                text: 'GitHub Storage Limits',
                children: [],
              },
              {
                id: 'heading-storage-provider-comparison',
                level: 3,
                text: 'Storage Provider Comparison',
                children: [],
              },
            ],
          },
          {
            id: 'heading-security-considerations',
            level: 2,
            text: 'Security Considerations',
            children: [
              {
                id: 'heading-s3-bucket-policies',
                level: 3,
                text: 'S3 Bucket Policies',
                children: [],
              },
              {
                id: 'heading-github-repository-settings',
                level: 3,
                text: 'GitHub Repository Settings',
                children: [],
              },
              {
                id: 'heading-environment-variables',
                level: 3,
                text: 'Environment Variables',
                children: [],
              },
            ],
          },
        ],
      },
    ],
  },
]

// Helper function to find TOC data by file path
export function getTocByFile(filePath: string): TocItem[] | undefined {
  const item = tocData.find((item) => item.file === filePath)
  return item?.toc
}

// Helper function to find TOC data by route path
export function getTocByPath(routePath: string): TocItem[] | undefined {
  const item = tocData.find((item) => item.path === routePath)
  return item?.toc
}

// Helper function to flatten TOC tree into a simple array
export function flattenToc(toc: TocItem[]): TocItem[] {
  const result: TocItem[] = []

  function traverse(items: TocItem[]) {
    for (const item of items) {
      result.push({
        id: item.id,
        level: item.level,
        text: item.text,
      })
      if (item.children && item.children.length > 0) {
        traverse(item.children)
      }
    }
  }

  traverse(toc)
  return result
}

// Helper function to get all headings at a specific level
export function getHeadingsByLevel(toc: TocItem[], level: number): TocItem[] {
  const result: TocItem[] = []

  function traverse(items: TocItem[]) {
    for (const item of items) {
      if (item.level === level) {
        result.push(item)
      }
      if (item.children && item.children.length > 0) {
        traverse(item.children)
      }
    }
  }

  traverse(toc)
  return result
}
