"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
require("./RegistrationsList.css");
var _jsxRuntime = require("react/jsx-runtime");
function RegistrationsList(_ref) {
  let registrations = _ref.registrations,
    _ref$title = _ref.title,
    title = _ref$title === void 0 ? 'Liste des inscrits' : _ref$title,
    _ref$headingLevel = _ref.headingLevel,
    headingLevel = _ref$headingLevel === void 0 ? 'h2' : _ref$headingLevel,
    _ref$highlightedIndex = _ref.highlightedIndex,
    highlightedIndex = _ref$highlightedIndex === void 0 ? null : _ref$highlightedIndex,
    _ref$testId = _ref.testId,
    testId = _ref$testId === void 0 ? 'registrations-list-section' : _ref$testId,
    _ref$emptyMessage = _ref.emptyMessage,
    emptyMessage = _ref$emptyMessage === void 0 ? 'Aucun inscrit pour le moment.' : _ref$emptyMessage;
  const HeadingTag = headingLevel;
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
    className: "registrations-section",
    "data-testid": testId,
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(HeadingTag, {
      children: title
    }), registrations.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
      "data-testid": "no-registrations",
      children: emptyMessage
    }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
      "data-testid": "registrations-list",
      children: registrations.map((registration, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
        "data-testid": "registration-item",
        "data-highlight-index": index,
        className: index === highlightedIndex ? 'registration-item-highlight' : undefined,
        children: [registration.prenom, " ", registration.nom, " - ", registration.email, " -", ' ', registration.dateOfBirth, " - ", registration.ville, " (", registration.codePostal, ")"]
      }, "".concat(registration.email, "-").concat(index)))
    })]
  });
}
var _default = exports.default = RegistrationsList;