import SnmpVersion from "./SnmpMonitor/SnmpVersion";
import SnmpSecurityLevel from "./SnmpMonitor/SnmpSecurityLevel";
export class MonitorStepSnmpMonitorUtil {
    static getDefault() {
        return {
            snmpVersion: SnmpVersion.V2c,
            hostname: "",
            port: 161,
            communityString: "public",
            oids: [],
            timeout: 5000,
            retries: 3,
        };
    }
    static fromJSON(json) {
        return {
            snmpVersion: json["snmpVersion"] || SnmpVersion.V2c,
            hostname: json["hostname"] || "",
            port: json["port"] || 161,
            communityString: json["communityString"] || undefined,
            snmpV3Auth: json["snmpV3Auth"]
                ? MonitorStepSnmpMonitorUtil.parseSnmpV3Auth(json["snmpV3Auth"])
                : undefined,
            oids: MonitorStepSnmpMonitorUtil.parseOids(json["oids"] || []),
            timeout: json["timeout"] || 5000,
            retries: json["retries"] || 3,
        };
    }
    static parseSnmpV3Auth(json) {
        return {
            securityLevel: json["securityLevel"] ||
                SnmpSecurityLevel.NoAuthNoPriv,
            username: json["username"] || "",
            authProtocol: json["authProtocol"] || undefined,
            authKey: json["authKey"] || undefined,
            privProtocol: json["privProtocol"] || undefined,
            privKey: json["privKey"] || undefined,
        };
    }
    static parseOids(oids) {
        return oids.map((oid) => {
            return {
                oid: oid["oid"] || "",
                name: oid["name"] || undefined,
                description: oid["description"] || undefined,
            };
        });
    }
    static toJSON(monitor) {
        return {
            snmpVersion: monitor.snmpVersion,
            hostname: monitor.hostname,
            port: monitor.port,
            communityString: monitor.communityString,
            snmpV3Auth: monitor.snmpV3Auth
                ? {
                    securityLevel: monitor.snmpV3Auth.securityLevel,
                    username: monitor.snmpV3Auth.username,
                    authProtocol: monitor.snmpV3Auth.authProtocol,
                    authKey: monitor.snmpV3Auth.authKey,
                    privProtocol: monitor.snmpV3Auth.privProtocol,
                    privKey: monitor.snmpV3Auth.privKey,
                }
                : undefined,
            oids: monitor.oids.map((oid) => {
                return {
                    oid: oid.oid,
                    name: oid.name,
                    description: oid.description,
                };
            }),
            timeout: monitor.timeout,
            retries: monitor.retries,
        };
    }
}
//# sourceMappingURL=MonitorStepSnmpMonitor.js.map