import type { ModuleId } from '@/shared/types/app';
import type { DirectorQuickActionConfig } from '@/shared/constants/directorDashboard';
import { Button } from '@/components/ui/button';
import {
  directorQuickActionIcons,
  directorQuickActionToneClasses,
} from '@/components/director-dashboard/directorDashboardViewConfig';

interface DirectorQuickActionsProps {
  readonly actions: readonly DirectorQuickActionConfig[];
  readonly onOpenModule: (module: ModuleId) => void;
}

export function DirectorQuickActions({
  actions,
  onOpenModule,
}: DirectorQuickActionsProps) {
  return (
    <div className="bg-white rounded-2xl border border-violet-100 shadow-sm p-5">
      <h3 className="font-semibold text-gray-800 mb-3">Quick Actions</h3>
      <div className="space-y-2">
        {actions.map((action) => {
          const ActionIcon = action.iconId ? directorQuickActionIcons[action.iconId] : undefined;

          return (
            <Button
              key={action.label}
              type="button"
              onClick={() => onOpenModule(action.module)}
              className={`w-full h-auto text-left px-4 py-2.5 rounded-xl text-sm font-medium transition-all flex items-center gap-2 justify-start ${directorQuickActionToneClasses[action.tone]}`}
            >
              {ActionIcon && <ActionIcon size={14} />}
              {action.label}
            </Button>
          );
        })}
      </div>
    </div>
  );
}
