import{__spreadArray as e,__assign as s}from'./../../../ext-esm/tslib/tslib.es6.js';import{jsx as r,jsxs as t,Fragment as a}from"react/jsx-runtime";import i from"classnames";import{Accordion as l,AccordionSummary as n,Box as o,AccordionDetails as c}from"@material-ui/core";import{ExpandMore as m}from"@material-ui/icons";import{useDQUnvalidatedContentStyles as d}from"../styles.js";import{ALERT_STATES as u}from"../constants.js";import{DQAlertTooltip as p}from"./DQAlertTooltip.js";import{DQStatusIcon as f}from"./DQStatusIcon.js";import{getCategoryIconType as h}from"../utils.js";var g=function(g){var v=g.assets,N=d({}),y=v.reduce((function(s,r){return s[r.alert.category]||(s[r.alert.category]=[]),s[r.alert.category]=e(e([],s[r.alert.category],!0),[r],!1),s}),{});return r("div",{children:Object.keys(y).map((function(e){var d=h(y[e]);return t(l,{children:[r(n,s({className:i("left",N.categoryName),expandIcon:r(m,{})},{children:t(o,s({display:"flex",alignItems:"center",justifyContent:"space-between",gridColumnGap:4,width:200},{children:[r("span",{children:"".concat(e," (").concat(y[e].length,")")}),r(f,{color:d,iconType:d})]}))})),r(c,{children:r("div",s({className:N.assetTable},{children:y[e].map((function(e){var l=e.id,n=e.name,o=e.issuesNum,c=e.missingNum,m=e.isResolved,d=e.alert,f=e.linkToDQPage,h=function(e){return{alert:d,alertsNum:e===u.issue?o:c,alertState:e===u.issue?u.issue:u.missing,isIssueData:o>0,linkToDQPage:f}},g=h(u.issue),v=h(u.missing);return t("div",s({className:N.assetWrapper},{children:[r("div",s({className:i(N.assetName,N.assetCell)},{children:n})),m?r("div",s({className:N.assetCell},{children:r(p,s({},g))})):t(a,{children:[o>0&&r("div",s({className:N.assetCell},{children:r(p,s({},g))})),c>0&&r("div",s({className:N.assetCell},{children:r(p,s({},v))}))]})]}),l)}))}))})]},e)}))})};export{g as DQAccordionDetailsContent};
