var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import React, { forwardRef, Fragment } from 'react';
import FluentPrimaryStatNumber from '../../FluentComponents/molecules/FluentPrimaryStatNumber';
import WidgetCard from '../../WidgetCard';
import { LinearProgress, Typography, Divider, makeStyles } from '@material-ui/core';
import FluentSecondaryStatNumber from '../../FluentComponents/molecules/FluentSecondaryStatNumber';
import { convertISODate } from '../../utils/ConvertISODate';
export const layout = {
    w: { default: 2, min: 0, max: 4 },
    h: { default: 2, min: 0, max: 4 }
};
const useStyles = makeStyles((theme) => ({
    root: {},
    displayItems: {
        display: 'flex',
        flexDirection: 'row',
        justifyContent: 'space-around',
        color: 'white'
    },
    divider: {
        marginTop: theme.spacing(4),
        marginBottom: theme.spacing(2)
    }
}));
const ProgressBarWidget = (props, ref) => {
    const { children, params, setParam } = props, other = __rest(props, ["children", "params", "setParam"]);
    const { mockData, apiUrl, theme, dateRange } = params;
    const classes = useStyles();
    return (React.createElement(WidgetCard, Object.assign({ theme: theme, ref: ref }, other, { title: mockData === null || mockData === void 0 ? void 0 : mockData.title, widgetType: "ProgressBarWidget" }), mockData ? (React.createElement(Fragment, null, dateRange && (React.createElement(Typography, { gutterBottom: true, variant: "caption", component: "h3" }, "Starting: ", convertISODate(dateRange.from))), React.createElement(FluentPrimaryStatNumber, { mainStat: mockData === null || mockData === void 0 ? void 0 : mockData.value, mainLabel: mockData === null || mockData === void 0 ? void 0 : mockData.label }), React.createElement("div", null, React.createElement(LinearProgress, { variant: "determinate", color: "secondary", value: mockData === null || mockData === void 0 ? void 0 : mockData.progress }), mockData === null || mockData === void 0 ? void 0 : mockData.progress), (mockData === null || mockData === void 0 ? void 0 : mockData.data) && (React.createElement(Fragment, null, React.createElement("div", { className: classes.divider }, React.createElement(Divider, { style: { background: 'white', opacity: 0.5 } })), React.createElement("div", { className: classes.displayItems }, mockData === null || mockData === void 0 ? void 0 : mockData.data.map((item, index) => {
        return (React.createElement(FluentSecondaryStatNumber, { secondaryStat: item.value, secondaryLabel: item.label, trend: item.trend }));
    })))), children)) : (React.createElement(Typography, { variant: "subtitle2" }, "Could not retrieve widget data. Please contact support"))));
};
export default forwardRef(ProgressBarWidget);
//# sourceMappingURL=ProgressBarWidget.js.map