'use client'

/**
 * 營運 (/operations) — Sprint 5 整合頁面
 * 整合: 部署管理 + 工單 + 成本分析 + 行動日誌 + 計費
 * 全部使用 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 { DeploymentsPanel } from '@/components/panels/DeploymentsPanel'
import { TicketsPanel } from '@/components/panels/TicketsPanel'
import { CostPanel } from '@/components/panels/CostPanel'
import { ActionLogsPanel } from '@/components/panels/ActionLogsPanel'
import { BillingPanel } from '@/components/panels/BillingPanel'

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

  const tabs: TabConfig[] = [
    { id: 'deployments', label: t('deployments'), content: <DeploymentsPanel /> },
    { id: 'tickets', label: t('tickets'), content: <TicketsPanel /> },
    { id: 'cost', label: t('cost'), content: <CostPanel /> },
    { id: 'logs', label: t('actions'), content: <ActionLogsPanel /> },
    { id: 'billing', label: t('billing'), content: <BillingPanel /> },
  ]

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