import React from 'react';

import { RoleFormModal } from './modal';
import type { RolePageTreeNode } from '../types';

interface CreateModalProps {
  onClose: () => void;
  onSuccess?: () => void;
  pageTreeData?: RolePageTreeNode[];
}

export const CreateModal: React.FC<CreateModalProps> = ({
  onClose,
  onSuccess,
  pageTreeData,
}) => {
  const handleMutationSuccess = () => {
    onSuccess?.();
    onClose?.();
  };

  return (
    <RoleFormModal
      action="create"
      onCancel={onClose}
      onMutationSuccess={handleMutationSuccess}
      pageTreeData={pageTreeData}
    />
  );
};
