import React from 'react';
import Modal from '../ui/Modal';
import ResourceSkillsPanel, { type SkillLine } from './ResourceSkillsPanel';
import type { ClinicResource, Skill } from '../../types';

interface Props {
  resource: ClinicResource | null;
  skills: Skill[];
  saving: boolean;
  onClose: () => void;
  onSave: (lines: SkillLine[]) => void;
}

/** همان پنل مهارت‌ها، در قاب مودالِ فهرست منابع. */
export default function ResourceSkillsModal({ resource, skills, saving, onClose, onSave }: Props) {
  return (
    <Modal open={resource !== null} onClose={onClose} title={`مهارت‌های ${resource?.name ?? 'منبع'}`}>
      <ResourceSkillsPanel
        resource={resource}
        skills={skills}
        saving={saving}
        onCancel={onClose}
        onSave={onSave}
      />
    </Modal>
  );
}
