'use client'

/**
 * 自動化 (/automation) — Sprint 5 整合頁面
 * 整合: 自動修復 + 神經指揮 + Drift 偵測
 * 全部使用 Panel 元件 (無雙重 AppLayout)
 * 建立時間: 2026-04-08 (台北時區)
 * 更新時間: 2026-04-09 — 全部 Tab Panel 抽取完成
 */

import { useTranslations } from 'next-intl'
import { AppLayout } from '@/components/layout'
import { PageTabs, type TabConfig } from '@/components/layout/page-tabs'
import { AutoRepairPanel } from '@/components/panels/AutoRepairPanel'
import { NeuralCommandPanel } from '@/components/panels/NeuralCommandPanel'
import { DriftPanel } from '@/components/panels/DriftPanel'

export default function AutomationPage({ params }: { params: { locale: string } }) {
  const t = useTranslations('nav')

  const tabs: TabConfig[] = [
    { id: 'repair', label: t('autoRepair'), content: <AutoRepairPanel /> },
    { id: 'neural', label: t('neuralCommand'), content: <NeuralCommandPanel /> },
    { id: 'drift', label: t('drift'), content: <DriftPanel /> },
  ]

  return (
    <AppLayout locale={params.locale}>
      <PageTabs tabs={tabs} defaultTab="repair" syncWithUrl={true} />
    </AppLayout>
  )
}
