# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2020 Raritan Inc. All rights reserved.
#
# This is an auto-generated file.

#
# Section generated by IdlC from "Zeroconf.idl"
#

import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.devsettings

import raritan.rpc.idl


# interface
class Zeroconf(Interface):
    idlType = "devsettings.Zeroconf:2.0.0"

    # structure
    class Settings(Structure):
        idlType = "devsettings.Zeroconf_2_0_0.Settings:1.0.0"
        elements = ["mdnsEnabled", "llmnrEnabled"]

        def __init__(self, mdnsEnabled, llmnrEnabled):
            typecheck.is_bool(mdnsEnabled, AssertionError)
            typecheck.is_bool(llmnrEnabled, AssertionError)

            self.mdnsEnabled = mdnsEnabled
            self.llmnrEnabled = llmnrEnabled

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                mdnsEnabled = json['mdnsEnabled'],
                llmnrEnabled = json['llmnrEnabled'],
            )
            return obj

        def encode(self):
            json = {}
            json['mdnsEnabled'] = self.mdnsEnabled
            json['llmnrEnabled'] = self.llmnrEnabled
            return json

    # value object
    class SettingsChangedEvent(raritan.rpc.idl.Event):
        idlType = "devsettings.Zeroconf_2_0_0.SettingsChangedEvent:1.0.0"

        def __init__(self, oldSettings, newSettings, source):
            super(raritan.rpc.devsettings.Zeroconf.SettingsChangedEvent, self).__init__(source)
            typecheck.is_struct(oldSettings, raritan.rpc.devsettings.Zeroconf.Settings, AssertionError)
            typecheck.is_struct(newSettings, raritan.rpc.devsettings.Zeroconf.Settings, AssertionError)

            self.oldSettings = oldSettings
            self.newSettings = newSettings

        def encode(self):
            json = super(raritan.rpc.devsettings.Zeroconf.SettingsChangedEvent, self).encode()
            json['oldSettings'] = raritan.rpc.devsettings.Zeroconf.Settings.encode(self.oldSettings)
            json['newSettings'] = raritan.rpc.devsettings.Zeroconf.Settings.encode(self.newSettings)
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                oldSettings = raritan.rpc.devsettings.Zeroconf.Settings.decode(json['oldSettings'], agent),
                newSettings = raritan.rpc.devsettings.Zeroconf.Settings.decode(json['newSettings'], agent),
                # for idl.Event
                source = Interface.decode(json['source'], agent),
            )
            return obj

        def listElements(self):
            elements = ["oldSettings", "newSettings"]
            elements = elements + super(raritan.rpc.devsettings.Zeroconf.SettingsChangedEvent, self).listElements()
            return elements

    class _getSettings(Interface.Method):
        name = 'getSettings'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.devsettings.Zeroconf.Settings.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.devsettings.Zeroconf.Settings, DecodeException)
            return _ret_

    class _setSettings(Interface.Method):
        name = 'setSettings'

        @staticmethod
        def encode(settings):
            typecheck.is_struct(settings, raritan.rpc.devsettings.Zeroconf.Settings, AssertionError)
            args = {}
            args['settings'] = raritan.rpc.devsettings.Zeroconf.Settings.encode(settings)
            return args

        @staticmethod
        def decode(rsp, agent):
            return None
    def __init__(self, target, agent):
        super(Zeroconf, self).__init__(target, agent)
        self.getSettings = Zeroconf._getSettings(self)
        self.setSettings = Zeroconf._setSettings(self)

#
# Section generated by IdlC from "Modbus.idl"
#

import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.devsettings


# interface
class Modbus(Interface):
    idlType = "devsettings.Modbus:2.0.0"

    ERR_INVALID_PARAM = 1

    # structure
    class Capabilities(Structure):
        idlType = "devsettings.Modbus_2_0_0.Capabilities:1.0.0"
        elements = ["hasModbusSerial"]

        def __init__(self, hasModbusSerial):
            typecheck.is_bool(hasModbusSerial, AssertionError)

            self.hasModbusSerial = hasModbusSerial

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                hasModbusSerial = json['hasModbusSerial'],
            )
            return obj

        def encode(self):
            json = {}
            json['hasModbusSerial'] = self.hasModbusSerial
            return json

    class _getCapabilities(Interface.Method):
        name = 'getCapabilities'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.devsettings.Modbus.Capabilities.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.devsettings.Modbus.Capabilities, DecodeException)
            return _ret_

    # structure
    class TcpSettings(Structure):
        idlType = "devsettings.Modbus_2_0_0.TcpSettings:1.0.0"
        elements = ["readonly"]

        def __init__(self, readonly):
            typecheck.is_bool(readonly, AssertionError)

            self.readonly = readonly

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                readonly = json['readonly'],
            )
            return obj

        def encode(self):
            json = {}
            json['readonly'] = self.readonly
            return json

    # enumeration
    class Parity(Enumeration):
        idlType = "devsettings.Modbus_2_0_0.Parity:1.0.0"
        values = ["NONE", "EVEN", "ODD"]

    Parity.NONE = Parity(0)
    Parity.EVEN = Parity(1)
    Parity.ODD = Parity(2)

    # structure
    class SerialSettings(Structure):
        idlType = "devsettings.Modbus_2_0_0.SerialSettings:1.0.0"
        elements = ["enabled", "baudrate", "parity", "stopbits", "readonly"]

        def __init__(self, enabled, baudrate, parity, stopbits, readonly):
            typecheck.is_bool(enabled, AssertionError)
            typecheck.is_int(baudrate, AssertionError)
            typecheck.is_enum(parity, raritan.rpc.devsettings.Modbus.Parity, AssertionError)
            typecheck.is_int(stopbits, AssertionError)
            typecheck.is_bool(readonly, AssertionError)

            self.enabled = enabled
            self.baudrate = baudrate
            self.parity = parity
            self.stopbits = stopbits
            self.readonly = readonly

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                enabled = json['enabled'],
                baudrate = json['baudrate'],
                parity = raritan.rpc.devsettings.Modbus.Parity.decode(json['parity']),
                stopbits = json['stopbits'],
                readonly = json['readonly'],
            )
            return obj

        def encode(self):
            json = {}
            json['enabled'] = self.enabled
            json['baudrate'] = self.baudrate
            json['parity'] = raritan.rpc.devsettings.Modbus.Parity.encode(self.parity)
            json['stopbits'] = self.stopbits
            json['readonly'] = self.readonly
            return json

    # structure
    class Settings(Structure):
        idlType = "devsettings.Modbus_2_0_0.Settings:1.0.0"
        elements = ["tcp", "serial", "primaryUnitId"]

        def __init__(self, tcp, serial, primaryUnitId):
            typecheck.is_struct(tcp, raritan.rpc.devsettings.Modbus.TcpSettings, AssertionError)
            typecheck.is_struct(serial, raritan.rpc.devsettings.Modbus.SerialSettings, AssertionError)
            typecheck.is_int(primaryUnitId, AssertionError)

            self.tcp = tcp
            self.serial = serial
            self.primaryUnitId = primaryUnitId

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                tcp = raritan.rpc.devsettings.Modbus.TcpSettings.decode(json['tcp'], agent),
                serial = raritan.rpc.devsettings.Modbus.SerialSettings.decode(json['serial'], agent),
                primaryUnitId = json['primaryUnitId'],
            )
            return obj

        def encode(self):
            json = {}
            json['tcp'] = raritan.rpc.devsettings.Modbus.TcpSettings.encode(self.tcp)
            json['serial'] = raritan.rpc.devsettings.Modbus.SerialSettings.encode(self.serial)
            json['primaryUnitId'] = self.primaryUnitId
            return json

    class _getSettings(Interface.Method):
        name = 'getSettings'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.devsettings.Modbus.Settings.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.devsettings.Modbus.Settings, DecodeException)
            return _ret_

    class _setSettings(Interface.Method):
        name = 'setSettings'

        @staticmethod
        def encode(settings):
            typecheck.is_struct(settings, raritan.rpc.devsettings.Modbus.Settings, AssertionError)
            args = {}
            args['settings'] = raritan.rpc.devsettings.Modbus.Settings.encode(settings)
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_
    def __init__(self, target, agent):
        super(Modbus, self).__init__(target, agent)
        self.getCapabilities = Modbus._getCapabilities(self)
        self.getSettings = Modbus._getSettings(self)
        self.setSettings = Modbus._setSettings(self)

#
# Section generated by IdlC from "Smtp.idl"
#

import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.devsettings


# interface
class Smtp(Interface):
    idlType = "devsettings.Smtp:2.0.0"

    ERR_INVALID_PARAMS = 1

    # structure
    class Configuration(Structure):
        idlType = "devsettings.Smtp_2_0_0.Configuration:1.0.0"
        elements = ["host", "port", "useTls", "allowOffTimeRangeCerts", "caCertChain", "sender", "useAuth", "username", "password", "retryCount", "retryInterval"]

        def __init__(self, host, port, useTls, allowOffTimeRangeCerts, caCertChain, sender, useAuth, username, password, retryCount, retryInterval):
            typecheck.is_string(host, AssertionError)
            typecheck.is_int(port, AssertionError)
            typecheck.is_bool(useTls, AssertionError)
            typecheck.is_bool(allowOffTimeRangeCerts, AssertionError)
            typecheck.is_string(caCertChain, AssertionError)
            typecheck.is_string(sender, AssertionError)
            typecheck.is_bool(useAuth, AssertionError)
            typecheck.is_string(username, AssertionError)
            typecheck.is_string(password, AssertionError)
            typecheck.is_int(retryCount, AssertionError)
            typecheck.is_int(retryInterval, AssertionError)

            self.host = host
            self.port = port
            self.useTls = useTls
            self.allowOffTimeRangeCerts = allowOffTimeRangeCerts
            self.caCertChain = caCertChain
            self.sender = sender
            self.useAuth = useAuth
            self.username = username
            self.password = password
            self.retryCount = retryCount
            self.retryInterval = retryInterval

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                host = json['host'],
                port = json['port'],
                useTls = json['useTls'],
                allowOffTimeRangeCerts = json['allowOffTimeRangeCerts'],
                caCertChain = json['caCertChain'],
                sender = json['sender'],
                useAuth = json['useAuth'],
                username = json['username'],
                password = json['password'],
                retryCount = json['retryCount'],
                retryInterval = json['retryInterval'],
            )
            return obj

        def encode(self):
            json = {}
            json['host'] = self.host
            json['port'] = self.port
            json['useTls'] = self.useTls
            json['allowOffTimeRangeCerts'] = self.allowOffTimeRangeCerts
            json['caCertChain'] = self.caCertChain
            json['sender'] = self.sender
            json['useAuth'] = self.useAuth
            json['username'] = self.username
            json['password'] = self.password
            json['retryCount'] = self.retryCount
            json['retryInterval'] = self.retryInterval
            return json

    class _getConfiguration(Interface.Method):
        name = 'getConfiguration'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.devsettings.Smtp.Configuration.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.devsettings.Smtp.Configuration, DecodeException)
            return _ret_

    class _setConfiguration(Interface.Method):
        name = 'setConfiguration'

        @staticmethod
        def encode(cfg):
            typecheck.is_struct(cfg, raritan.rpc.devsettings.Smtp.Configuration, AssertionError)
            args = {}
            args['cfg'] = raritan.rpc.devsettings.Smtp.Configuration.encode(cfg)
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_

    # structure
    class TestResult(Structure):
        idlType = "devsettings.Smtp_2_0_0.TestResult:1.0.0"
        elements = ["status", "message"]

        def __init__(self, status, message):
            typecheck.is_int(status, AssertionError)
            typecheck.is_string(message, AssertionError)

            self.status = status
            self.message = message

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                status = json['status'],
                message = json['message'],
            )
            return obj

        def encode(self):
            json = {}
            json['status'] = self.status
            json['message'] = self.message
            return json

    class _testConfiguration(Interface.Method):
        name = 'testConfiguration'

        @staticmethod
        def encode(cfg, recipients):
            typecheck.is_struct(cfg, raritan.rpc.devsettings.Smtp.Configuration, AssertionError)
            for x0 in recipients:
                typecheck.is_string(x0, AssertionError)
            args = {}
            args['cfg'] = raritan.rpc.devsettings.Smtp.Configuration.encode(cfg)
            args['recipients'] = [x0 for x0 in recipients]
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.devsettings.Smtp.TestResult.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.devsettings.Smtp.TestResult, DecodeException)
            return _ret_
    def __init__(self, target, agent):
        super(Smtp, self).__init__(target, agent)
        self.getConfiguration = Smtp._getConfiguration(self)
        self.setConfiguration = Smtp._setConfiguration(self)
        self.testConfiguration = Smtp._testConfiguration(self)

#
# Section generated by IdlC from "Snmp.idl"
#

import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.devsettings

import raritan.rpc.idl


# interface
class Snmp(Interface):
    idlType = "devsettings.Snmp:1.0.2"

    ERR_INVALID_PARAMS = 1

    # structure
    class Configuration(Structure):
        idlType = "devsettings.Snmp_1_0_2.Configuration:1.0.0"
        elements = ["v2enable", "v3enable", "readComm", "writeComm", "sysContact", "sysName", "sysLocation"]

        def __init__(self, v2enable, v3enable, readComm, writeComm, sysContact, sysName, sysLocation):
            typecheck.is_bool(v2enable, AssertionError)
            typecheck.is_bool(v3enable, AssertionError)
            typecheck.is_string(readComm, AssertionError)
            typecheck.is_string(writeComm, AssertionError)
            typecheck.is_string(sysContact, AssertionError)
            typecheck.is_string(sysName, AssertionError)
            typecheck.is_string(sysLocation, AssertionError)

            self.v2enable = v2enable
            self.v3enable = v3enable
            self.readComm = readComm
            self.writeComm = writeComm
            self.sysContact = sysContact
            self.sysName = sysName
            self.sysLocation = sysLocation

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                v2enable = json['v2enable'],
                v3enable = json['v3enable'],
                readComm = json['readComm'],
                writeComm = json['writeComm'],
                sysContact = json['sysContact'],
                sysName = json['sysName'],
                sysLocation = json['sysLocation'],
            )
            return obj

        def encode(self):
            json = {}
            json['v2enable'] = self.v2enable
            json['v3enable'] = self.v3enable
            json['readComm'] = self.readComm
            json['writeComm'] = self.writeComm
            json['sysContact'] = self.sysContact
            json['sysName'] = self.sysName
            json['sysLocation'] = self.sysLocation
            return json

    # value object
    class ConfigurationChangedEvent(raritan.rpc.idl.Event):
        idlType = "devsettings.Snmp_1_0_2.ConfigurationChangedEvent:1.0.0"

        def __init__(self, userName, ipAddr, oldConfig, newConfig, source):
            super(raritan.rpc.devsettings.Snmp.ConfigurationChangedEvent, self).__init__(source)
            typecheck.is_string(userName, AssertionError)
            typecheck.is_string(ipAddr, AssertionError)
            typecheck.is_struct(oldConfig, raritan.rpc.devsettings.Snmp.Configuration, AssertionError)
            typecheck.is_struct(newConfig, raritan.rpc.devsettings.Snmp.Configuration, AssertionError)

            self.userName = userName
            self.ipAddr = ipAddr
            self.oldConfig = oldConfig
            self.newConfig = newConfig

        def encode(self):
            json = super(raritan.rpc.devsettings.Snmp.ConfigurationChangedEvent, self).encode()
            json['userName'] = self.userName
            json['ipAddr'] = self.ipAddr
            json['oldConfig'] = raritan.rpc.devsettings.Snmp.Configuration.encode(self.oldConfig)
            json['newConfig'] = raritan.rpc.devsettings.Snmp.Configuration.encode(self.newConfig)
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                userName = json['userName'],
                ipAddr = json['ipAddr'],
                oldConfig = raritan.rpc.devsettings.Snmp.Configuration.decode(json['oldConfig'], agent),
                newConfig = raritan.rpc.devsettings.Snmp.Configuration.decode(json['newConfig'], agent),
                # for idl.Event
                source = Interface.decode(json['source'], agent),
            )
            return obj

        def listElements(self):
            elements = ["userName", "ipAddr", "oldConfig", "newConfig"]
            elements = elements + super(raritan.rpc.devsettings.Snmp.ConfigurationChangedEvent, self).listElements()
            return elements

    class _getConfiguration(Interface.Method):
        name = 'getConfiguration'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.devsettings.Snmp.Configuration.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.devsettings.Snmp.Configuration, DecodeException)
            return _ret_

    class _setConfiguration(Interface.Method):
        name = 'setConfiguration'

        @staticmethod
        def encode(cfg):
            typecheck.is_struct(cfg, raritan.rpc.devsettings.Snmp.Configuration, AssertionError)
            args = {}
            args['cfg'] = raritan.rpc.devsettings.Snmp.Configuration.encode(cfg)
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_

    class _getV3EngineId(Interface.Method):
        name = 'getV3EngineId'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = rsp['_ret_']
            typecheck.is_string(_ret_, DecodeException)
            return _ret_
    def __init__(self, target, agent):
        super(Snmp, self).__init__(target, agent)
        self.getConfiguration = Snmp._getConfiguration(self)
        self.setConfiguration = Snmp._setConfiguration(self)
        self.getV3EngineId = Snmp._getV3EngineId(self)
