import CabinetManager from "./CabinetManager";

var ConfigfileSample = {
  fileDiffererntMessageKey = '',
  deviceKey = '',
  differentType = -1,
  deviceName = '',
  deviceTypeKey = '',
  deviceModel = '',
  subnetName = '',
  delFlag = -1,
}

//ConfigfileCollection里可能不止一个，需修改
class ConfigfileManager {
  findFileDifferentMessageKey(ConfigfileCollection,fileDiffererntMessageKey){
    return ConfigfileCollection[fileDiffererntMessageKey]
  }

  findDeviceKey(ConfigfileCollection,deviceKey){
    return ConfigfileCollection[deviceKey]
  }

  findDifferenType(ConfigfileCollection,differentType){
    return ConfigfileCollection[differentType]
  }

  findDeviceName(ConfigfileCollection,deviceName){
    return ConfigfileCollection[deviceName]
  }

  findDeviceTypeKey(ConfigfileCollection,deviceTypeKey){
    return ConfigfileCollection[deviceTypeKey]
  }

  finddeviceModel(ConfigfileCollection,deviceModel){
    return ConfigfileCollection[deviceModel]
  }

  findSubnetName(ConfigfileCollection,subnetName){
    return ConfigfileCollection[subnetName]
  }

  FindDelFlag(ConfigfileCollection,delFlag){
    return ConfigfileCollection[delFlag]
  }
}

let implementMethods = new ConfigfileMgrImplement()

var staticMethods = {
  createDeviceSample: function () {
    return Object.freeze(Object.assign({}, cabinetSmaple))
  }
}

function ConfigfileManager(ConfigfileCollection) {
  function findFileDifferentMessageKey (ConfigfileCollection,fileDiffererntMessageKey) {
    return implementMethods.findFileDifferentMessageKey(ConfigfileCollection,fileDiffererntMessageKey)
  }

  function findDeviceKey (ConfigfileCollection,deviceKey) {
    return implementMethods.findDeviceKey(ConfigfileCollection,deviceKey)
  }

  function findDifferentType (ConfigfileCollection,differentType) {
    return implementMethods.findDeviceKey(ConfigfileCollection,differentType)
  }


}

export default ConfigfileManager
