import copy

from ereuse_devicehub.resources.device.schema import Device
from ereuse_devicehub.resources.device.settings import DeviceSubSettings


class Peripheral(Device):
    type = {
        'type': 'string',
        'allowed': {'Router', 'Switch', 'Printer', 'Scanner', 'MultifunctionPrinter', 'Terminal', 'HUB', 'SAI',
                    'Keyboard', 'Mouse', 'WirelessAccessPoint', 'LabelPrinter', 'Projector', 'VideoconferenceDevice'},
        'required': True
    }
    manufacturer = copy.copy(Device.manufacturer)
    manufacturer['required'] = True
    serialNumber = copy.copy(Device.serialNumber)
    serialNumber['required'] = True
    model = copy.copy(Device.model)
    model['required'] = True


class PeripheralSettings(DeviceSubSettings):
    _schema = Peripheral

import copy

from ereuse_devicehub.resources.device.schema import Device
from ereuse_devicehub.resources.device.settings import DeviceSubSettings


class Peripheral(Device):
    type = {
        'type': 'string',
        'allowed': {
            'Router', 'Switch', 'Printer', 'Scanner', 'MultifunctionPrinter', 'Terminal', 'HUB',
            'SAI', 'Keyboard', 'Mouse', 'WirelessAccessPoint', 'LabelPrinter', 'Projector',
            'VideoconferenceDevice', 'SoundDevice', 'Microphone', 'WirelessMicrophone',
            'Scaler', 'VideoScaler', 'MemoryCardReader', 'Amplifier', 'AudioAmplifier'
        },
        'required': True
    }
    manufacturer = copy.copy(Device.manufacturer)
    manufacturer['required'] = True
    serialNumber = copy.copy(Device.serialNumber)
    serialNumber['required'] = True
    model = copy.copy(Device.model)
    model['required'] = True


class PeripheralSettings(DeviceSubSettings):
    _schema = Peripheral

Add new types of peripherals
Add new types of peripherals

  import copy
  
  from ereuse_devicehub.resources.device.schema import Device
  from ereuse_devicehub.resources.device.settings import DeviceSubSettings
  
  
  class Peripheral(Device):
      type = {
          'type': 'string',
+         'allowed': {
-         'allowed': {'Router', 'Switch', 'Printer', 'Scanner', 'MultifunctionPrinter', 'Terminal', 'HUB', 'SAI',
+             'Router', 'Switch', 'Printer', 'Scanner', 'MultifunctionPrinter', 'Terminal', 'HUB',
-                     'Keyboard', 'Mouse', 'WirelessAccessPoint', 'LabelPrinter', 'Projector', 'VideoconferenceDevice'},
+             'SAI', 'Keyboard', 'Mouse', 'WirelessAccessPoint', 'LabelPrinter', 'Projector',
+             'VideoconferenceDevice', 'SoundDevice', 'Microphone', 'WirelessMicrophone',
+             'Scaler', 'VideoScaler', 'MemoryCardReader', 'Amplifier', 'AudioAmplifier'
+         },
          'required': True
      }
      manufacturer = copy.copy(Device.manufacturer)
      manufacturer['required'] = True
      serialNumber = copy.copy(Device.serialNumber)
      serialNumber['required'] = True
      model = copy.copy(Device.model)
      model['required'] = True
  
  
  class PeripheralSettings(DeviceSubSettings):
      _schema = Peripheral
  
Add new types of peripherals
## Code Before:
import copy

from ereuse_devicehub.resources.device.schema import Device
from ereuse_devicehub.resources.device.settings import DeviceSubSettings


class Peripheral(Device):
    type = {
        'type': 'string',
        'allowed': {'Router', 'Switch', 'Printer', 'Scanner', 'MultifunctionPrinter', 'Terminal', 'HUB', 'SAI',
                    'Keyboard', 'Mouse', 'WirelessAccessPoint', 'LabelPrinter', 'Projector', 'VideoconferenceDevice'},
        'required': True
    }
    manufacturer = copy.copy(Device.manufacturer)
    manufacturer['required'] = True
    serialNumber = copy.copy(Device.serialNumber)
    serialNumber['required'] = True
    model = copy.copy(Device.model)
    model['required'] = True


class PeripheralSettings(DeviceSubSettings):
    _schema = Peripheral

## Instruction:
Add new types of peripherals
## Code After:
import copy

from ereuse_devicehub.resources.device.schema import Device
from ereuse_devicehub.resources.device.settings import DeviceSubSettings


class Peripheral(Device):
    type = {
        'type': 'string',
        'allowed': {
            'Router', 'Switch', 'Printer', 'Scanner', 'MultifunctionPrinter', 'Terminal', 'HUB',
            'SAI', 'Keyboard', 'Mouse', 'WirelessAccessPoint', 'LabelPrinter', 'Projector',
            'VideoconferenceDevice', 'SoundDevice', 'Microphone', 'WirelessMicrophone',
            'Scaler', 'VideoScaler', 'MemoryCardReader', 'Amplifier', 'AudioAmplifier'
        },
        'required': True
    }
    manufacturer = copy.copy(Device.manufacturer)
    manufacturer['required'] = True
    serialNumber = copy.copy(Device.serialNumber)
    serialNumber['required'] = True
    model = copy.copy(Device.model)
    model['required'] = True


class PeripheralSettings(DeviceSubSettings):
    _schema = Peripheral
