//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
using Luban;
using System.Text.Json;
namespace cfg.test
{
public sealed partial class TestMap : Luban.BeanBase
{
public TestMap(JsonElement _buf)
{
Id = _buf.GetProperty("id").GetInt32();
Id_Ref = null;
{ var __json0 = _buf.GetProperty("x1"); X1 = new System.Collections.Generic.Dictionary(__json0.GetArrayLength()); foreach(JsonElement __e0 in __json0.EnumerateArray()) { int _k0; _k0 = __e0[0].GetInt32(); int _v0; _v0 = __e0[1].GetInt32(); X1.Add(_k0, _v0); } }
{ var __json0 = _buf.GetProperty("x2"); X2 = new System.Collections.Generic.Dictionary(__json0.GetArrayLength()); foreach(JsonElement __e0 in __json0.EnumerateArray()) { long _k0; _k0 = __e0[0].GetInt64(); int _v0; _v0 = __e0[1].GetInt32(); X2.Add(_k0, _v0); } }
{ var __json0 = _buf.GetProperty("x3"); X3 = new System.Collections.Generic.Dictionary(__json0.GetArrayLength()); foreach(JsonElement __e0 in __json0.EnumerateArray()) { string _k0; _k0 = __e0[0].GetString(); int _v0; _v0 = __e0[1].GetInt32(); X3.Add(_k0, _v0); } }
{ var __json0 = _buf.GetProperty("x4"); X4 = new System.Collections.Generic.Dictionary(__json0.GetArrayLength()); foreach(JsonElement __e0 in __json0.EnumerateArray()) { test.DemoEnum _k0; _k0 = (test.DemoEnum)__e0[0].GetInt32(); int _v0; _v0 = __e0[1].GetInt32(); X4.Add(_k0, _v0); } }
}
public static TestMap DeserializeTestMap(JsonElement _buf)
{
return new test.TestMap(_buf);
}
public readonly int Id;
public test.TestIndex Id_Ref;
public readonly System.Collections.Generic.Dictionary X1;
public readonly System.Collections.Generic.Dictionary X2;
public readonly System.Collections.Generic.Dictionary X3;
public readonly System.Collections.Generic.Dictionary X4;
public const int __ID__ = -543227410;
public override int GetTypeId() => __ID__;
public void ResolveRef(Tables tables)
{
Id_Ref = tables.TbTestIndex.GetOrDefault(Id);
}
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "x1:" + Luban.StringUtil.CollectionToString(X1) + ","
+ "x2:" + Luban.StringUtil.CollectionToString(X2) + ","
+ "x3:" + Luban.StringUtil.CollectionToString(X3) + ","
+ "x4:" + Luban.StringUtil.CollectionToString(X4) + ","
+ "}";
}
}
}