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

use strict;

package Raritan::RPC::firmware::ImageInfo_1_0_1;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'valid'} = ($in->{'valid'}) ? JSON::true : JSON::false;
    $encoded->{'version'} = "$in->{'version'}";
    $encoded->{'min_required_version'} = "$in->{'min_required_version'}";
    $encoded->{'min_downgrade_version'} = "$in->{'min_downgrade_version'}";
    $encoded->{'product'} = "$in->{'product'}";
    $encoded->{'platform'} = "$in->{'platform'}";
    $encoded->{'oem'} = "$in->{'oem'}";
    $encoded->{'hwid_whitelist'} = "$in->{'hwid_whitelist'}";
    $encoded->{'hwid_blacklist'} = "$in->{'hwid_blacklist'}";
    $encoded->{'compatible'} = ($in->{'compatible'}) ? JSON::true : JSON::false;
    $encoded->{'signature_present'} = ($in->{'signature_present'}) ? JSON::true : JSON::false;
    $encoded->{'signed_by'} = "$in->{'signed_by'}";
    $encoded->{'signature_good'} = ($in->{'signature_good'}) ? JSON::true : JSON::false;
    $encoded->{'certified_by'} = "$in->{'certified_by'}";
    $encoded->{'certificate_good'} = ($in->{'certificate_good'}) ? JSON::true : JSON::false;
    $encoded->{'model_list_present'} = ($in->{'model_list_present'}) ? JSON::true : JSON::false;
    $encoded->{'model_supported'} = ($in->{'model_supported'}) ? JSON::true : JSON::false;
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'valid'} = ($in->{'valid'}) ? 1 : 0;
    $decoded->{'version'} = $in->{'version'};
    $decoded->{'min_required_version'} = $in->{'min_required_version'};
    $decoded->{'min_downgrade_version'} = $in->{'min_downgrade_version'};
    $decoded->{'product'} = $in->{'product'};
    $decoded->{'platform'} = $in->{'platform'};
    $decoded->{'oem'} = $in->{'oem'};
    $decoded->{'hwid_whitelist'} = $in->{'hwid_whitelist'};
    $decoded->{'hwid_blacklist'} = $in->{'hwid_blacklist'};
    $decoded->{'compatible'} = ($in->{'compatible'}) ? 1 : 0;
    $decoded->{'signature_present'} = ($in->{'signature_present'}) ? 1 : 0;
    $decoded->{'signed_by'} = $in->{'signed_by'};
    $decoded->{'signature_good'} = ($in->{'signature_good'}) ? 1 : 0;
    $decoded->{'certified_by'} = $in->{'certified_by'};
    $decoded->{'certificate_good'} = ($in->{'certificate_good'}) ? 1 : 0;
    $decoded->{'model_list_present'} = ($in->{'model_list_present'}) ? 1 : 0;
    $decoded->{'model_supported'} = ($in->{'model_supported'}) ? 1 : 0;
    return $decoded;
}

1;
