import type {ReactNode} from 'react';
import clsx from 'clsx';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Layout from '@theme/Layout';
import Heading from '@theme/Heading';

import styles from './index.module.css';

function HomepageHeader() {
  const {siteConfig} = useDocusaurusContext();
  return (
    <header className={clsx('hero hero--primary', styles.heroBanner)}>
      <div className="container">
        <Heading as="h1" className="hero__title">
          {siteConfig.title}
        </Heading>
        <p className="hero__subtitle">{siteConfig.tagline}</p>
        <div className={styles.buttons}>
          <Link className="button button--secondary button--lg" to="/docs/intro">
            Read the docs
          </Link>
        </div>
      </div>
    </header>
  );
}

export default function Home(): ReactNode {
  return (
    <Layout
      title="Documentation"
      description="Songs2VID docs — payment-free self-host setup, video editing, and REST API.">
      <HomepageHeader />
      <main>
        <section className="container margin-vert--xl">
          <div className="row">
            <div className="col col--4 margin-bottom--lg">
              <Heading as="h3">Get started</Heading>
              <p>Run Postgres, Redis, OAuth, and the worker locally.</p>
              <Link to="/docs/getting-started">Getting started →</Link>
            </div>
            <div className="col col--4 margin-bottom--lg">
              <Heading as="h3">Video editing</Heading>
              <p>Art-track layouts, blur, typography, and watermark fine-tuning.</p>
              <Link to="/docs/video-editing">Composition guide →</Link>
            </div>
            <div className="col col--4 margin-bottom--lg">
              <Heading as="h3">REST API</Heading>
              <p>Upload, jobs, batch, layouts, and playlists.</p>
              <Link to="/docs/api/overview">API overview →</Link>
            </div>
          </div>
        </section>
      </main>
    </Layout>
  );
}
