'use client'

/**
 * GovernancePage — AI 治理中樞 (/governance)
 * ============================================
 * PR 2: 頁面骨架 + Sidebar 入口 + 三 Tab 空殼
 * PR 3-5 將填入 SLO / 治理事件 / AI 待辦 真實內容
 *
 * 設計方向: Nothing.tech × Anthropic Warmth
 *   - ComplianceBadge 橫幅作為頁面頂部的治理狀態信號
 *   - 0.5px 邊框 / DM Mono 字體 / #d97757 橘紅 accent
 *
 * @created 2026-05-02 Claude Sonnet 4.6 — governance PR 2
 */

import { useTranslations } from 'next-intl'
import { ShieldCheck } from 'lucide-react'
import { AppLayout } from '@/components/layout'
import { PageTabs, type TabConfig } from '@/components/layout/page-tabs'
import { IwoooSReadOnlyBridge } from '@/components/security/iwooos-read-only-bridge'
import { GlassCard } from '@/components/ui/glass-card'
import { SloTab } from './tabs/slo-tab'
import { EventsTab } from './tabs/events-tab'
import { QueueTab } from './tabs/queue-tab'
import { AgentMarketTab } from './tabs/agent-market-tab'
import { AutomationInventoryTab } from './tabs/automation-inventory-tab'

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

  const tabs: TabConfig[] = [
    { id: 'slo',    label: t('tabs.slo'),    content: <SloTab /> },
    { id: 'events', label: t('tabs.events'), content: <EventsTab /> },
    { id: 'queue',  label: t('tabs.queue'),  content: <QueueTab /> },
    { id: 'agent-market', label: t('tabs.agentMarket'), content: <AgentMarketTab /> },
    { id: 'automation-inventory', label: t('tabs.automationInventory'), content: <AutomationInventoryTab /> },
  ]

  return (
    <AppLayout locale={params.locale}>
      {/* ComplianceBadge 橫幅 — PR 3 接 /governance/compliance-score API */}
      <GlassCard variant="subtle" padding="sm" className="mb-3">
        <div className="flex items-center gap-2">
          <ShieldCheck size={14} style={{ color: '#d97757' }} />
          <span style={{ fontFamily: 'Syne, sans-serif', fontWeight: 700, fontSize: 15, color: '#141413' }}>
            {t('complianceBadge.label')}
          </span>
        </div>
      </GlassCard>

      <IwoooSReadOnlyBridge />

      <PageTabs tabs={tabs} defaultTab="slo" syncWithUrl={true} />
    </AppLayout>
  )
}
