'use client';

import React from 'react';
import { Card } from '@/components/ui/card';
import { RoleManagementStats, Role } from '../types';

interface RoleManagementStatsCardsProps {
  roles: Role[];
}

export function RoleManagementStatsCards({ roles }: RoleManagementStatsCardsProps) {
  const stats: RoleManagementStats[] = [
    {
      label: '总角色数',
      value: roles.length,
      color: 'text-blue-600',
      bg: 'bg-blue-100',
    },
    {
      label: '系统角色',
      value: roles.filter(r => r.type === 'system').length,
      color: 'text-purple-600',
      bg: 'bg-purple-100',
    },
    {
      label: '自定义角色',
      value: roles.filter(r => r.type === 'custom').length,
      color: 'text-green-600',
      bg: 'bg-green-100',
    },
  ];

  return (
    <div className="grid grid-cols-3 gap-4">
      {stats.map((stat, index) => (
        <Card key={index} className="p-4">
          <div className="text-sm text-muted-foreground">{stat.label}</div>
          <div className={`mt-2 ${stat.color} text-2xl font-semibold`}>{stat.value}</div>
        </Card>
      ))}
    </div>
  );
}