class HubMinimumFirmwareVersionResolver implements MinimumFirmwareVersionResolver<Hub> {

   @Override
   public Version resolveMinimumVersion(Hub hub) {
      String minHubVersion = null;
      Population population = null;
      String populationName = null;
      String model = null;
      if (hub != null && hub.getPlace() != null) {
      	populationName = placeDao.getPopulationById(hub.getPlace());
      }

      if(StringUtils.isNotBlank(populationName)) {
    	  population = populationDao.findByName(populationName);
      } 
      if (population == null) {
    	  population = populationDao.getDefaultPopulation();
      }
      // TODO:  Remove the need to check for model and make the hub more like a device, especially around firmware upgrade.
      model = hub.getModel();
      if (model == null) return null;
      switch (model) {
	      case "IH300":
	      case "IH304":
	        minHubVersion = population.getMinHubV3Version();    	  
	      	break;
	      case "IH200":
		      	minHubVersion = population.getMinHubV2Version();
		      	break;
	      default:
	    	  return null;
	  }
      return Version.fromRepresentation(minHubVersion);
   }

   @Inject public  HubMinimumFirmwareVersionResolver(PlaceDAO placeDao, PopulationDAO populationDao);

}