# fmt: off
# Auto-generated by https://github.com/mos9527/UnityPyTypetreeCodegen
from typing import List, Union, Optional, TypeVar
from UnityPy.classes import *
from UnityPy.classes.math import (ColorRGBA, Matrix3x4f, Matrix4x4f, Quaternionf, Vector2f, Vector3f, Vector4f, float3, float4,)
T = TypeVar("T")
def UTTCGen(clazz : T) -> T:
	"""dataclass-like decorator for typetree classess with nested type support
	
	limitations:
	- the behavior is similar to slotted dataclasses where shared attributes are inherited
	  but allows ommiting init of the parent if kwargs are not sufficient
	- generally supports nested types, however untested and could be slow	
    - and ofc, zero type checking and safeguards :/	
	"""
	RESERVED_KWS = {'object_reader'}
    # Allow these to be propogated to the props
	def __init__(self, **d):
		def enusre_reserved(obj):
			for k in RESERVED_KWS:
				if hasattr(obj, k) and k in d:
					setattr(obj, k, d[k])
			return obj		
		def reduce_init(clazz, **d):
			types : dict = clazz.__annotations__
			for k, sub in types.items():
				if type(sub) == str:
					sub = eval(sub) # attrs turns these into strings...why?
				reduce_arg = getattr(sub, "__args__", [None])[0]
				if isinstance(d[k], list):
					if hasattr(reduce_arg, "__annotations__"):
						setattr(self, k, [enusre_reserved(reduce_arg(**x)) for x in d[k]])
					else:
						setattr(self, k, [enusre_reserved(reduce_arg(x)) for x in d[k]])
				elif isinstance(d[k], dict) and hasattr(sub, "__annotations__"):
					setattr(self, k, enusre_reserved(sub(**d[k])))
				else:
					if isinstance(d[k], dict):
						setattr(self, k, enusre_reserved(sub(**d[k])))
					else:
						setattr(self, k, enusre_reserved(sub(d[k])))			
		for __base__ in clazz.__bases__:
			types : dict = __base__.__annotations__
			args = {k:d[k] for k in types if k in d}
			if len(args) == len(types):
				super(clazz, self).__init__(**args)
				reduce_init(__base__, **d)
				for k in args:
					if not k in RESERVED_KWS: del d[k]
		reduce_init(clazz, **d)
		enusre_reserved(self)
	def __repr__(self) -> str:
		return f"{clazz.__name__}({', '.join([f'{k}={getattr(self, k)!r}' for k in self.__annotations__])})"
	clazz.__init__ = __init__
	clazz.__repr__ = __repr__
	return clazz
    
# Helper functions
def UTTCGen_Reread(Mono: MonoBehaviour):
    script = Mono.m_Script.read()
    fullname = script.m_ClassName
    if script.m_Namespace:
        fullname = f"{script.m_Namespace}.{fullname}"
    definition = TYPETREE_DEFS.get(fullname, None)
    assert definition is not None, f"Typetree definition for {fullname} not found"
    raw_def = Mono.object_reader.read_typetree(definition)
    return raw_def, fullname

TYPETREE_DEFS = {
    "Sekai.PlayerSettingConfig": [
        {
            "m_Type": "MonoBehaviour",
            "m_Name": "Base",
            "m_Level": 0,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "PPtr<GameObject>",
            "m_Name": "m_GameObject",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "int",
            "m_Name": "m_FileID",
            "m_Level": 2,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "SInt64",
            "m_Name": "m_PathID",
            "m_Level": 2,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "UInt8",
            "m_Name": "m_Enabled",
            "m_Level": 1,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "PPtr<MonoScript>",
            "m_Name": "m_Script",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "int",
            "m_Name": "m_FileID",
            "m_Level": 2,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "SInt64",
            "m_Name": "m_PathID",
            "m_Level": 2,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "m_Name",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "memo",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "clientMajorVersion",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "clientMinorVersion",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "clientBuildVersion",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "snapshot",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "clientVersionSuffix",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "clientDataMajorVersion",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "clientDataMinorVersion",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "clientDataBuildVersion",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "clientDataRevision",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "companyName",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "productName",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "bundleIdentifier",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "bundleVersion",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "assetHash",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "clientAppHash",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "string",
            "m_Name": "adMobAppId",
            "m_Level": 1,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "Array",
            "m_Name": "Array",
            "m_Level": 2,
            "m_MetaFlag": 16384
        },
        {
            "m_Type": "int",
            "m_Name": "size",
            "m_Level": 3,
            "m_MetaFlag": 0
        },
        {
            "m_Type": "char",
            "m_Name": "data",
            "m_Level": 3,
            "m_MetaFlag": 0
        }
    ]
}