"use client"

import * as React from "react"
import { TeamSidebar } from "@/components/team-sidebar"
import { ScheduleTabs } from "@/components/schedule-tabs"
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
  BreadcrumbSeparator,
} from "@/components/ui/breadcrumb"
import { Separator } from "@/components/ui/separator"
import { SidebarInset, SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar"

// Team data for display
const teamData = {
  tkb: "TKB",
  metro: "METRO",
  d8: "D8",
}

export default function TimeshiftManager() {
  const [selectedTeam, setSelectedTeam] = React.useState("tkb")

  return (
    <SidebarProvider>
      <TeamSidebar selectedTeam={selectedTeam} onTeamSelect={setSelectedTeam} />
      <SidebarInset>
        <header className="flex h-16 shrink-0 items-center gap-2 border-b px-4">
          <SidebarTrigger className="-ml-1" />
          <Separator orientation="vertical" className="mr-2 h-4" />
          <Breadcrumb>
            <BreadcrumbList>
              <BreadcrumbItem className="hidden md:block">
                <BreadcrumbLink href="#">TimeShift 161</BreadcrumbLink>
              </BreadcrumbItem>
              <BreadcrumbSeparator className="hidden md:block" />
              <BreadcrumbItem>
                <BreadcrumbPage>{teamData[selectedTeam as keyof typeof teamData]}</BreadcrumbPage>
              </BreadcrumbItem>
            </BreadcrumbList>
          </Breadcrumb>
        </header>
        <div className="flex flex-1 flex-col gap-4 p-4">
          <ScheduleTabs teamId={selectedTeam} teamName={teamData[selectedTeam as keyof typeof teamData]} />
        </div>
      </SidebarInset>
    </SidebarProvider>
  )
}
