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

use strict;

package Raritan::RPC::fitness::HardwareHealth_1_0_2::Failure;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'creationOrderId'} = 1 * $in->{'creationOrderId'};
    $encoded->{'componentId'} = "$in->{'componentId'}";
    $encoded->{'type'} = 1 * $in->{'type'};
    $encoded->{'description'} = "$in->{'description'}";
    $encoded->{'isAsserted'} = ($in->{'isAsserted'}) ? JSON::true : JSON::false;
    $encoded->{'lastAssertTimeStamp'} = 1 * $in->{'lastAssertTimeStamp'};
    $encoded->{'lastDeassertTimeStamp'} = 1 * $in->{'lastDeassertTimeStamp'};
    $encoded->{'assertCount'} = 1 * $in->{'assertCount'};
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'creationOrderId'} = $in->{'creationOrderId'};
    $decoded->{'componentId'} = $in->{'componentId'};
    $decoded->{'type'} = $in->{'type'};
    $decoded->{'description'} = $in->{'description'};
    $decoded->{'isAsserted'} = ($in->{'isAsserted'}) ? 1 : 0;
    $decoded->{'lastAssertTimeStamp'} = $in->{'lastAssertTimeStamp'};
    $decoded->{'lastDeassertTimeStamp'} = $in->{'lastDeassertTimeStamp'};
    $decoded->{'assertCount'} = $in->{'assertCount'};
    return $decoded;
}

1;
