import React from 'react';
import PropTypes from 'prop-types';
import InputTextWithTitle from '../../atom/input-text-with-title';
import CourseSection from '../course-section';
import DraggableList from '../draggable-list';
import Loader from '../../atom/loader';
import Title from '../../atom/title';
import TitleAndCheckBoxWrapper from '../title-and-checkbox-wrapper';
import style from './style.css';
const Loading = () => /*#__PURE__*/React.createElement("div", {
  className: style.loaderContainer
}, /*#__PURE__*/React.createElement(Loader, {
  className: style.loader,
  theme: "coorpmanager"
}));
const CourseSections = ({
  sections,
  onDrop,
  isLoading,
  title,
  mandatoryCoursesInput,
  inputTitle,
  totalCourses
}) => {
  if (isLoading) return /*#__PURE__*/React.createElement(Loading, null);
  const child = {
    ...mandatoryCoursesInput,
    childType: 'input-text'
  };
  const sectionTitle = {
    title: inputTitle,
    'data-name': 'mandatory-courses-input-title'
  };
  return /*#__PURE__*/React.createElement("div", null, mandatoryCoursesInput && sectionTitle ? /*#__PURE__*/React.createElement(TitleAndCheckBoxWrapper, {
    child: child,
    sectionTitle: sectionTitle
  }) : null, title ? /*#__PURE__*/React.createElement("div", {
    className: style.title
  }, /*#__PURE__*/React.createElement(Title, {
    title: title,
    type: 'form-group',
    "data-name": 'course-sections-title'
  }), totalCourses ? /*#__PURE__*/React.createElement(Title, {
    title: totalCourses,
    type: 'form-group',
    "data-name": 'course-sections-total-courses'
  }) : null) : null, /*#__PURE__*/React.createElement(DraggableList, {
    itemType: "course-section",
    items: sections,
    onDrop: onDrop
  }));
};
CourseSections.propTypes = process.env.NODE_ENV !== "production" ? {
  inputTitle: PropTypes.string,
  title: PropTypes.string,
  totalCourses: PropTypes.string,
  sections: PropTypes.arrayOf(PropTypes.shape(CourseSection.propTypes)),
  onDrop: PropTypes.func,
  isLoading: PropTypes.bool,
  mandatoryCoursesInput: PropTypes.shape(InputTextWithTitle.propTypes)
} : {};
export default CourseSections;
//# sourceMappingURL=index.js.map