import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { BatteryLevelCriticalIcon } from '../../../lib/icons/BatteryLevelCritical.js';
import { BatteryLevelFullIcon } from '../../../lib/icons/BatteryLevelFull.js';
import { BatteryLevelHighIcon } from '../../../lib/icons/BatteryLevelHigh.js';
import { BatteryLevelLowIcon } from '../../../lib/icons/BatteryLevelLow.js';
export function BatteryStatusIndicator(props) {
    return (_jsx("div", { className: 'seam-battery-status', children: _jsx(Content, { status: props.device.properties.battery?.status, level: props.device.properties.battery?.level }) }));
}
function Content(props) {
    const { status, level } = props;
    if (status === 'full') {
        return (_jsxs(_Fragment, { children: [_jsx(BatteryLevelFullIcon, { style: { fontSize: '24px' } }), _jsxs("span", { className: 'seam-status-text', children: [t.full, _jsx(Percentage, { level: level })] })] }));
    }
    if (status === 'good') {
        return (_jsxs(_Fragment, { children: [_jsx(BatteryLevelHighIcon, { style: { fontSize: '24px' } }), _jsxs("span", { className: 'seam-status-text', children: [t.high, _jsx(Percentage, { level: level })] })] }));
    }
    if (status === 'low') {
        return (_jsxs(_Fragment, { children: [_jsx(BatteryLevelLowIcon, { style: { fontSize: '24px' } }), _jsxs("span", { className: 'seam-status-text', children: [t.low, _jsx(Percentage, { level: level })] })] }));
    }
    if (status === 'critical') {
        return (_jsxs(_Fragment, { children: [_jsx(BatteryLevelCriticalIcon, { style: { fontSize: '24px' } }), _jsxs("span", { className: 'seam-text-danger', children: [t.critical, _jsx(Percentage, { level: level })] })] }));
    }
    return null;
}
function Percentage(props) {
    if (props.level == null)
        return null;
    return _jsxs(_Fragment, { children: [" (", Math.floor(props.level * 100), "%)"] });
}
const t = {
    full: 'Good',
    high: 'Good',
    low: 'Low',
    critical: 'Low!',
};
//# sourceMappingURL=BatteryStatusIndicator.js.map