class DeviceOfflineGenerator extends AlertGenerator {

   @Override
   protected void handleMessage(SubsystemContext<PlaceMonitorSubsystemModel> context, AlertScratchPad scratch, PlatformMessage msg, Model m) {
      switch(msg.getMessageType()) {
         case PlaceMonitorSubsystemCapability.DeviceOfflineEvent.NAME:
            scratch.putAlert(SmartHomeAlerts.create(
               SmartHomeAlert.ALERTTYPE_DEV_ERR_OFFLINE,
               SmartHomeAlert.SEVERITY_CRITICAL,
               PlaceMonitorSubsystemCapability.DeviceOfflineEvent.getDeviceAddress(msg.getValue()),
               SmartHomeAlerts.baseDeviceAttribues(m, prodCat),
               context.getPlaceId()
            ));
            break;
         case PlaceMonitorSubsystemCapability.DeviceOnlineEvent.NAME:
            scratch.removeAlert(AlertKeys.key(SmartHomeAlert.ALERTTYPE_DEV_ERR_OFFLINE, PlaceMonitorSubsystemCapability.DeviceOnlineEvent.getDeviceAddress(msg.getValue())));
            scratch.removeAlert(AlertKeys.key(SmartHomeAlert.ALERTTYPE_DEV_ERR_OFFLINE_BATTERY, PlaceMonitorSubsystemCapability.DeviceOnlineEvent.getDeviceAddress(msg.getValue())));  // special removal for post processor alert type
            break;
         default:
            break;
      }
   }

   @Inject public  DeviceOfflineGenerator(ProductCatalogManager prodCat);

}