// src/app/[slug]/renderBySlug.tsx
import { notFound } from "next/navigation";

import ProductCategory from "@/components/product/category";
import ProductDetail from "@/components/product/detail";
import ArticleCategory from "@/components/article/category";
import ArticleDetail from "@/components/article/detail";
import ArticleHome from "@/components/article/home";

export function renderBySlug(result: any, slug: string) {
    switch (result.type) {
        case "product_category":
            return <ProductCategory slug={result.data} />;

        case "product_detail":
            return <ProductDetail slug={result.data} />;

        case "article_home":
            return <ArticleHome slug={slug} />;

        case "article_category":
            return <ArticleCategory slug={result.data} />;

        case "article_detail":
            return <ArticleDetail slug={result.data.slug} />;

        default:
            notFound();
    }
}
