// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright 2020 Raritan Inc. All rights reserved.
//
// This file was generated by IdlC from Event.idl.

using System;
using System.Linq;
using LightJson;
using Com.Raritan.Idl;
using Com.Raritan.JsonRpc;
using Com.Raritan.Util;

#pragma warning disable 0108, 0219, 0414, 1591

namespace Com.Raritan.JsonRpc.idl {
  public class Event_ValObjCodec : ValueObjectCodec
 {

    public static new void Register() {
      ValueObjectCodec.RegisterCodec(Com.Raritan.Idl.idl.Event.typeInfo, new Event_ValObjCodec());
    }

    public override void EncodeValObj(LightJson.JsonObject json, ValueObject vo) {
      var inst = (Com.Raritan.Idl.idl.Event)vo;
      json["source"] = inst.source != null ? inst.source.Encode() : JsonValue.Null;
    }

    public override ValueObject DecodeValObj(ValueObject vo, LightJson.JsonObject json, Agent agent) {
      Com.Raritan.Idl.idl.Event inst;
      if (vo == null) {
        inst = new Com.Raritan.Idl.idl.Event();
      } else {
        inst = (Com.Raritan.Idl.idl.Event)vo;
      }
      inst.source = ObjectProxy.Decode(json["source"], agent);
      return inst;
    }

  }
}
