# DO NOT EDIT
# This file was generated by idol_py, any changes will be lost when idol_py is rerun again
from ..__idol__ import Struct, Map, List, Primitive
from typing import MutableMapping, Optional, MutableSequence
from ...schema.field import Field as ScaffoldField
from ...schema.type_struct import TypeStruct as ScaffoldTypeStruct
from ...schema.reference import Reference as ScaffoldReference


class SchemaType(Struct):
    """
    A wrapper type containing fields that can describe a Type, as well as its tag metadata.
    """

    # When this type is a struct, each of its fields and the type of that field is included
    # Exclusive with is_a and options
    fields: MutableMapping[str, ScaffoldField]

    # Set when this is type is an alias or simply an type expression (such as a generic).
    # Exclusive with having values for options or fields.
    is_a: Optional[ScaffoldTypeStruct]

    # The name and module information of this type's definition.
    named: ScaffoldReference

    # When this type is an enum includes the string values for each enum entry.  Note that each
    # target language may have different rules for the enum constant names, but these entries are
    # canonical resident values.
    # Exclusive with is_a and fields.
    options: MutableSequence[str]

    # General metadata given to a type.  Currently, atleast_one for Repeated types is supported.
    # Custom codegen can use these tags to implement semantic types on top of simple logic types.
    # In general, however, tags are considred optional and should not be required to
    # deserialize / serializeconsume correct logical values.
    tags: MutableSequence[str]

    __field_constructors__ = [
        (
            "fields",
            "fields",
            Map.of(ScaffoldField, dict(atleast_one=False)),
            dict(optional=False),
        ),
        ("is_a", "is_a", ScaffoldTypeStruct, dict(optional=True),),
        ("named", "named", ScaffoldReference, dict(optional=False),),
        (
            "options",
            "options",
            List.of(Primitive.of(str), dict(atleast_one=False)),
            dict(optional=False),
        ),
        (
            "tags",
            "tags",
            List.of(Primitive.of(str), dict(atleast_one=False)),
            dict(optional=False),
        ),
    ]
