import { jsx as _jsx } from "react/jsx-runtime";
import { isLockDevice, isThermostatDevice } from 'seamapi';
import { useComponentTelemetry } from '../../../../lib/telemetry/index.js';
import { withRequiredCommonProps, } from '../../../../lib/seam/components/common-props.js';
import { LockDeviceDetails } from '../../../../lib/seam/components/DeviceDetails/LockDeviceDetails.js';
import { ThermostatDeviceDetails } from '../../../../lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js';
import { useDevice } from '../../../../lib/seam/devices/use-device.js';
export const NestedDeviceDetails = withRequiredCommonProps(DeviceDetails);
export function DeviceDetails({ deviceId, disableLockUnlock = false, disableDeleteAccessCode = false, onBack, className, }) {
    useComponentTelemetry('DeviceDetails');
    const { device } = useDevice({
        device_id: deviceId,
    });
    if (device == null) {
        return null;
    }
    const props = {
        disableLockUnlock,
        disableDeleteAccessCode,
        onBack,
        className,
    };
    if (isLockDevice(device)) {
        return _jsx(LockDeviceDetails, { device: device, ...props });
    }
    if (isThermostatDevice(device)) {
        return _jsx(ThermostatDeviceDetails, { device: device, ...props });
    }
    return null;
}
//# sourceMappingURL=DeviceDetails.js.map