import { createBrowserRouter } from "react-router";
import ProtectedLayout from "./pages/private/_layout";
import PublicLayout from "./pages/public/_layout";
import Dashboard from "./pages/private/dashboard";
import Users from "./pages/private/admin/users";
import Login from "./pages/public/login";
import Workshops from "./pages/private/workshops";
import Contactos from "./pages/private/contactos";
import Videos from "./pages/private/videos";
import User from "./pages/private/admin/user/[id]";
import CreateUser from "./pages/private/admin/createUser";
import CreateVideo from "./pages/private/admin/createVideo";
import EditVideo from "./pages/private/admin/editVideo/[id]";
import Video from "./pages/private/video/[id]";
import Logout from "./pages/public/logout";
import CreateWorkshop from "./pages/private/admin/createWorkshop";
import Workshop from "./pages/private/workshop/[id]";
import Search from "./pages/private/search";
import Profile from "./pages/private/profile";
import AdminLayout from "./pages/private/admin/_layout";
import EditWorkshop from "./pages/private/admin/editWorkshop/[id]";


export const router = createBrowserRouter(
    [
        {
        element: <ProtectedLayout />,
        children: [
            {path: "/dashboard", element: <Dashboard /> },
            {path: "/workshops", element: <Workshops /> },
            {path: "/workshop/:id", element: <Workshop /> },
            {path: "/contactos", element: <Contactos /> },
            {path: "/videos", element: <Videos /> },
            {path: "/video/:id", element: <Video /> },	
            {path: "/search", element: <Search /> },
            {path: "/profile", element: <Profile /> },
            {path: "/workshop/:id", element: <Workshop /> },

            {
                element: <AdminLayout />,
                children: [
                    {path: "/admin/users", element: <Users /> },
                    {path: "/admin/user/:id", element: <User /> },	
                    {path: "/admin/create-user", element: <CreateUser /> },
                    {path: "/admin/create-workshop", element: <CreateWorkshop /> },
                    {path: "/admin/edit-workshop/:id", element: <EditWorkshop /> },
                    {path: "/admin/create-video", element: <CreateVideo /> }, 
                    {path: "/admin/edit-video/:id", element: <EditVideo /> },
                ]
            }

        ]
    },
    {
        element: <PublicLayout />,
        children: [
            {
                path: "/",
                element: <Login />,
            },
            {
                path: "/login",
                element: <Login />,
            },
            {
                path: "/logout",
                element: <Logout />,
            },
            
        ]
    }
    ]
);
