# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2024 Raritan Inc. All rights reserved.
#
# This file was generated by IdlC from User.idl.

use strict;

package Raritan::RPC::usermgmt::SnmpV3Settings_2_0_0;


sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'enabled'} = ($in->{'enabled'}) ? JSON::true : JSON::false;
    $encoded->{'secLevel'} = 1 * $in->{'secLevel'};
    $encoded->{'authProtocol'} = 1 * $in->{'authProtocol'};
    $encoded->{'usePasswordAsAuthPassphrase'} = ($in->{'usePasswordAsAuthPassphrase'}) ? JSON::true : JSON::false;
    $encoded->{'haveAuthPassphrase'} = ($in->{'haveAuthPassphrase'}) ? JSON::true : JSON::false;
    $encoded->{'authPassphrase'} = "$in->{'authPassphrase'}";
    $encoded->{'privProtocol'} = 1 * $in->{'privProtocol'};
    $encoded->{'useAuthPassphraseAsPrivPassphrase'} = ($in->{'useAuthPassphraseAsPrivPassphrase'}) ? JSON::true : JSON::false;
    $encoded->{'havePrivPassphrase'} = ($in->{'havePrivPassphrase'}) ? JSON::true : JSON::false;
    $encoded->{'privPassphrase'} = "$in->{'privPassphrase'}";
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'enabled'} = ($in->{'enabled'}) ? 1 : 0;
    $decoded->{'secLevel'} = $in->{'secLevel'};
    $decoded->{'authProtocol'} = $in->{'authProtocol'};
    $decoded->{'usePasswordAsAuthPassphrase'} = ($in->{'usePasswordAsAuthPassphrase'}) ? 1 : 0;
    $decoded->{'haveAuthPassphrase'} = ($in->{'haveAuthPassphrase'}) ? 1 : 0;
    $decoded->{'authPassphrase'} = $in->{'authPassphrase'};
    $decoded->{'privProtocol'} = $in->{'privProtocol'};
    $decoded->{'useAuthPassphraseAsPrivPassphrase'} = ($in->{'useAuthPassphraseAsPrivPassphrase'}) ? 1 : 0;
    $decoded->{'havePrivPassphrase'} = ($in->{'havePrivPassphrase'}) ? 1 : 0;
    $decoded->{'privPassphrase'} = $in->{'privPassphrase'};
    return $decoded;
}

1;
