// REQ-USR-001: 权限页签条（权限组 active 承载权限列表 + 5 占位查看权限页签 disabled，D9）
import type { ReactNode } from 'react';
import { Tabs } from 'antd';
import { TAB_PERM_GROUP, PLACEHOLDER_TABS } from './constants';
import styles from './UserDetail.module.css';

export interface PermissionTabsProps {
  activeKey?: string;
  onChange?(key: string): void;
  children: ReactNode;
}

const GROUP_KEY = 'group';

export default function PermissionTabs({ activeKey, onChange, children }: PermissionTabsProps) {
  const items = [
    { key: GROUP_KEY, label: TAB_PERM_GROUP, children },
    ...PLACEHOLDER_TABS.map((label, idx) => ({
      key: 'placeholder-' + idx,
      label,
      disabled: true,
      children: null,
    })),
  ];

  return (
    <Tabs
      className={styles.permTabs}
      defaultActiveKey={GROUP_KEY}
      activeKey={activeKey}
      onChange={onChange}
      items={items}
    />
  );
}
