import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { ThermostatCoolIcon } from '../../../lib/icons/ThermostatCool.js';
import { ThermostatHeatIcon } from '../../../lib/icons/ThermostatHeat.js';
import { ThermostatHeatCoolIcon } from '../../../lib/icons/ThermostatHeatCool.js';
import { ThermostatOffIcon } from '../../../lib/icons/ThermostatOff.js';
import { Temperature } from '../../../lib/ui/thermostat/Temperature.js';
export function ClimateSettingStatus({ climateSetting, temperatureUnit = 'fahrenheit', iconPlacement = 'left', }) {
    return (_jsxs("div", { className: 'seam-climate-setting-status', children: [iconPlacement === 'left' && (_jsx(ClimateSettingIcon, { mode: climateSetting.hvac_mode_setting })), _jsx(Content, { mode: climateSetting.hvac_mode_setting, coolingSetPoint: {
                    fahrenheit: climateSetting.cooling_set_point_fahrenheit,
                    celsius: climateSetting.cooling_set_point_celsius,
                }, heatingSetPoint: {
                    fahrenheit: climateSetting.heating_set_point_fahrenheit,
                    celsius: climateSetting.heating_set_point_celsius,
                }, temperatureUnit: temperatureUnit }), iconPlacement === 'right' && (_jsx(ClimateSettingIcon, { mode: climateSetting.hvac_mode_setting }))] }));
}
function ClimateSettingIcon(props) {
    const { mode } = props;
    return (_jsxs("div", { className: 'seam-climate-setting-status-icon', children: [mode === 'cool' && _jsx(ThermostatCoolIcon, {}), mode === 'heat' && _jsx(ThermostatHeatIcon, {}), mode === 'heat_cool' && _jsx(ThermostatHeatCoolIcon, {}), mode === 'off' && _jsx(ThermostatOffIcon, {})] }));
}
function Content(props) {
    const { mode, coolingSetPoint, heatingSetPoint, temperatureUnit } = props;
    if (mode === 'cool' && isSetPoint(coolingSetPoint))
        return _jsx(Temperature, { ...coolingSetPoint, unit: temperatureUnit });
    if (mode === 'heat' && isSetPoint(heatingSetPoint))
        return _jsx(Temperature, { ...heatingSetPoint, unit: temperatureUnit });
    if (mode === 'heat_cool' &&
        isSetPoint(heatingSetPoint) &&
        isSetPoint(coolingSetPoint))
        return (_jsxs("span", { children: [_jsx(Temperature, { ...heatingSetPoint, unit: temperatureUnit }), ' - ', _jsx(Temperature, { ...coolingSetPoint, unit: temperatureUnit })] }));
    if (mode === 'off')
        return _jsx("span", { children: t.off });
    return null;
}
function isSetPoint(setPoint) {
    return setPoint.fahrenheit != null && setPoint.celsius != null;
}
const t = {
    off: 'Off',
};
//# sourceMappingURL=ClimateSettingStatus.js.map