import { BookingOptionPax } from '@qite/tide-client/build/types';
import { isEmpty } from 'lodash';
import React from 'react';
import SummaryPerPaxOptionGroup from './summary-per-pax-option-group';

interface SummaryBookingOptionPaxProps {
  pax: BookingOptionPax;
}

const SummaryBookingOptionPax: React.FC<SummaryBookingOptionPaxProps> = ({ pax }) => {
  return (
    <>
      {pax.groups.map((y, i) => {
        const paxOptions = y.options.filter((y) => y.isSelected);
        if (isEmpty(paxOptions)) return;

        return <SummaryPerPaxOptionGroup key={i} group={y} />;
      })}
    </>
  );
};

export default SummaryBookingOptionPax;
