import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import "./style.scss";
import RectangularIcon from "../../RectangularIcon";
import PersonViewExperienceDetails from "../PersonViewExperienceDetails";
import clsx from "clsx";
const PersonViewExperienceCard = ({ companyLogo = "", experienceDetails = [], onCompanyNameClick, filterIndustries, filterSkills, filterProducts, isExpIndustriesLoading = false, companyExp, isSummaryView = false, dataCy, productsObject, }) => {
    const groupedExperiences = {};
    experienceDetails.forEach((experience) => {
        const { companyName } = experience;
        if (!groupedExperiences[companyName]) {
            groupedExperiences[companyName] = [];
        }
        groupedExperiences[companyName].push(experience);
    });
    return (_jsx("div", { className: "personViewExperienceCard--Generic", children: Object.entries(groupedExperiences).map(([companyName, experiences]) => {
            const hasMultipleExperiences = experiences.length > 1;
            const companyDisplayName = companyExp?.companyName || experiences[0]?.companyName || companyName;
            return (_jsx("div", { children: experiences.map((experience, key) => {
                    return (_jsxs("div", { className: "parentDiv", children: [_jsxs("div", { className: "leftDiv", children: [key === 0 && (_jsx(RectangularIcon, { iconPath: companyLogo, altImageType: "company", iconSize: "48", placeholderSize: 40, companyName: companyDisplayName })), hasMultipleExperiences && key < experiences.length - 1 && (_jsx("div", { className: "divider" }))] }), _jsx("div", { className: clsx("experienceItem", {
                                    withBullet: hasMultipleExperiences,
                                }), children: _jsx(PersonViewExperienceDetails, { showCompanyName: hasMultipleExperiences && key === 0, experienceDetails: {
                                        ...experience,
                                        location: experience.location,
                                    }, onCompanyNameClick: onCompanyNameClick, filterIndustries: filterIndustries, filterSkills: filterSkills, filterProducts: filterProducts, isExpIndustriesLoading: isExpIndustriesLoading, singleExperience: !hasMultipleExperiences, companyExp: companyExp, isSummaryView: isSummaryView, dataCy: dataCy, productsObject: productsObject }) })] }, key));
                }) }, companyName));
        }) }));
};
export default PersonViewExperienceCard;
