#
# Autogenerated by Thrift
#
# DO NOT EDIT
#  @generated
#

from __future__ import annotations

import apache.thrift.metadata.thrift_types as _fbthrift_metadata


# TODO (ffrancet): This general pattern can be optimized by using tuples and dicts
# instead of re-generating thrift structs
def _fbthrift_gen_metadata_struct_SomeStruct(metadata_struct: _fbthrift_metadata.ThriftMetadata) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.SomeStruct"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(id=1, type=_fbthrift_metadata.ThriftType(t_enum=_fbthrift_metadata.ThriftEnumType(name="module.Metasyntactic")), name="reasonable", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=2, type=_fbthrift_metadata.ThriftType(t_enum=_fbthrift_metadata.ThriftEnumType(name="module.Metasyntactic")), name="fine", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=3, type=_fbthrift_metadata.ThriftType(t_enum=_fbthrift_metadata.ThriftEnumType(name="module.Metasyntactic")), name="questionable", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=4, type=_fbthrift_metadata.ThriftType(t_set=_fbthrift_metadata.ThriftSetType(valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE))), name="tags", is_optional=False, structured_annotations=[
        ]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(name=qualified_name, fields=fields,
        is_union=False,
        structured_annotations=[
        ])
    new_struct = metadata_struct(structs=struct_dict)

    # reasonable
    new_struct = _fbthrift_gen_metadata_enum_Metasyntactic(new_struct)    # fine
    new_struct = _fbthrift_gen_metadata_enum_Metasyntactic(new_struct)    # questionable
    new_struct = _fbthrift_gen_metadata_enum_Metasyntactic(new_struct)    # tags
    
    return new_struct
def gen_metadata_struct_SomeStruct() -> _fbthrift_metadata.ThriftMetadata:
    return _fbthrift_gen_metadata_struct_SomeStruct(_fbthrift_metadata.ThriftMetadata(structs={}, enums={}, exceptions={}, services={}))

# TODO (ffrancet): This general pattern can be optimized by using tuples and dicts
# instead of re-generating thrift structs
def _fbthrift_gen_metadata_struct_MyStruct(metadata_struct: _fbthrift_metadata.ThriftMetadata) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.MyStruct"

    if qualified_name in metadata_struct.structs:
        return metadata_struct
    fields = [
        _fbthrift_metadata.ThriftField(id=1, type=_fbthrift_metadata.ThriftType(t_enum=_fbthrift_metadata.ThriftEnumType(name="module.MyEnum2")), name="me2_3", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=2, type=_fbthrift_metadata.ThriftType(t_enum=_fbthrift_metadata.ThriftEnumType(name="module.MyEnum3")), name="me3_n3", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=4, type=_fbthrift_metadata.ThriftType(t_enum=_fbthrift_metadata.ThriftEnumType(name="module.MyEnum1")), name="me1_t1", is_optional=False, structured_annotations=[
        ]),
        _fbthrift_metadata.ThriftField(id=6, type=_fbthrift_metadata.ThriftType(t_enum=_fbthrift_metadata.ThriftEnumType(name="module.MyEnum1")), name="me1_t2", is_optional=False, structured_annotations=[
        ]),
    ]
    struct_dict = dict(metadata_struct.structs)
    struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(name=qualified_name, fields=fields,
        is_union=False,
        structured_annotations=[
        ])
    new_struct = metadata_struct(structs=struct_dict)

    # me2_3
    new_struct = _fbthrift_gen_metadata_enum_MyEnum2(new_struct)    # me3_n3
    new_struct = _fbthrift_gen_metadata_enum_MyEnum3(new_struct)    # me1_t1
    new_struct = _fbthrift_gen_metadata_enum_MyEnum1(new_struct)    # me1_t2
    new_struct = _fbthrift_gen_metadata_enum_MyEnum1(new_struct)
    return new_struct
def gen_metadata_struct_MyStruct() -> _fbthrift_metadata.ThriftMetadata:
    return _fbthrift_gen_metadata_struct_MyStruct(_fbthrift_metadata.ThriftMetadata(structs={}, enums={}, exceptions={}, services={}))



def _fbthrift_gen_metadata_enum_Metasyntactic(metadata_struct: _fbthrift_metadata.ThriftMetadata) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.Metasyntactic"

    if qualified_name in metadata_struct.enums:
        return metadata_struct
    elements = {
        1: "FOO",
        2: "BAR",
        3: "BAZ",
        4: "BAX",
    }
    structured_annotations = [
    ]
    enum_dict = dict(metadata_struct.enums)
    enum_dict[qualified_name] = _fbthrift_metadata.ThriftEnum(name=qualified_name, elements=elements, structured_annotations=structured_annotations)
    new_struct = metadata_struct(enums=enum_dict)

    return new_struct

def gen_metadata_enum_Metasyntactic() -> _fbthrift_metadata.ThriftMetadata:
    return _fbthrift_gen_metadata_enum_Metasyntactic(_fbthrift_metadata.ThriftMetadata(structs={}, enums={}, exceptions={}, services={}))
def _fbthrift_gen_metadata_enum_MyEnum1(metadata_struct: _fbthrift_metadata.ThriftMetadata) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.MyEnum1"

    if qualified_name in metadata_struct.enums:
        return metadata_struct
    elements = {
        0: "ME1_0",
        1: "ME1_1",
        2: "ME1_2",
        3: "ME1_3",
        5: "ME1_5",
        6: "ME1_6",
    }
    structured_annotations = [
    ]
    enum_dict = dict(metadata_struct.enums)
    enum_dict[qualified_name] = _fbthrift_metadata.ThriftEnum(name=qualified_name, elements=elements, structured_annotations=structured_annotations)
    new_struct = metadata_struct(enums=enum_dict)

    return new_struct

def gen_metadata_enum_MyEnum1() -> _fbthrift_metadata.ThriftMetadata:
    return _fbthrift_gen_metadata_enum_MyEnum1(_fbthrift_metadata.ThriftMetadata(structs={}, enums={}, exceptions={}, services={}))
def _fbthrift_gen_metadata_enum_MyEnum2(metadata_struct: _fbthrift_metadata.ThriftMetadata) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.MyEnum2"

    if qualified_name in metadata_struct.enums:
        return metadata_struct
    elements = {
        0: "ME2_0",
        1: "ME2_1",
        2: "ME2_2",
    }
    structured_annotations = [
    ]
    enum_dict = dict(metadata_struct.enums)
    enum_dict[qualified_name] = _fbthrift_metadata.ThriftEnum(name=qualified_name, elements=elements, structured_annotations=structured_annotations)
    new_struct = metadata_struct(enums=enum_dict)

    return new_struct

def gen_metadata_enum_MyEnum2() -> _fbthrift_metadata.ThriftMetadata:
    return _fbthrift_gen_metadata_enum_MyEnum2(_fbthrift_metadata.ThriftMetadata(structs={}, enums={}, exceptions={}, services={}))
def _fbthrift_gen_metadata_enum_MyEnum3(metadata_struct: _fbthrift_metadata.ThriftMetadata) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.MyEnum3"

    if qualified_name in metadata_struct.enums:
        return metadata_struct
    elements = {
        0: "ME3_0",
        1: "ME3_1",
        -2: "ME3_N2",
        -1: "ME3_N1",
        9: "ME3_9",
        10: "ME3_10",
    }
    structured_annotations = [
    ]
    enum_dict = dict(metadata_struct.enums)
    enum_dict[qualified_name] = _fbthrift_metadata.ThriftEnum(name=qualified_name, elements=elements, structured_annotations=structured_annotations)
    new_struct = metadata_struct(enums=enum_dict)

    return new_struct

def gen_metadata_enum_MyEnum3() -> _fbthrift_metadata.ThriftMetadata:
    return _fbthrift_gen_metadata_enum_MyEnum3(_fbthrift_metadata.ThriftMetadata(structs={}, enums={}, exceptions={}, services={}))
def _fbthrift_gen_metadata_enum_MyEnum4(metadata_struct: _fbthrift_metadata.ThriftMetadata) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.MyEnum4"

    if qualified_name in metadata_struct.enums:
        return metadata_struct
    elements = {
        2147483645: "ME4_A",
        2147483646: "ME4_B",
        2147483647: "ME4_C",
        -2147483648: "ME4_D",
    }
    structured_annotations = [
    ]
    enum_dict = dict(metadata_struct.enums)
    enum_dict[qualified_name] = _fbthrift_metadata.ThriftEnum(name=qualified_name, elements=elements, structured_annotations=structured_annotations)
    new_struct = metadata_struct(enums=enum_dict)

    return new_struct

def gen_metadata_enum_MyEnum4() -> _fbthrift_metadata.ThriftMetadata:
    return _fbthrift_gen_metadata_enum_MyEnum4(_fbthrift_metadata.ThriftMetadata(structs={}, enums={}, exceptions={}, services={}))
def _fbthrift_gen_metadata_enum_MyBitmaskEnum1(metadata_struct: _fbthrift_metadata.ThriftMetadata) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.MyBitmaskEnum1"

    if qualified_name in metadata_struct.enums:
        return metadata_struct
    elements = {
        1: "ONE",
        2: "TWO",
        4: "FOUR",
    }
    structured_annotations = [
        _fbthrift_metadata.ThriftConstStruct(type=_fbthrift_metadata.ThriftStructType(name="thrift.BitmaskEnum"), fields= {  }),
    ]
    enum_dict = dict(metadata_struct.enums)
    enum_dict[qualified_name] = _fbthrift_metadata.ThriftEnum(name=qualified_name, elements=elements, structured_annotations=structured_annotations)
    new_struct = metadata_struct(enums=enum_dict)

    return new_struct

def gen_metadata_enum_MyBitmaskEnum1() -> _fbthrift_metadata.ThriftMetadata:
    return _fbthrift_gen_metadata_enum_MyBitmaskEnum1(_fbthrift_metadata.ThriftMetadata(structs={}, enums={}, exceptions={}, services={}))
def _fbthrift_gen_metadata_enum_MyBitmaskEnum2(metadata_struct: _fbthrift_metadata.ThriftMetadata) -> _fbthrift_metadata.ThriftMetadata:
    qualified_name = "module.MyBitmaskEnum2"

    if qualified_name in metadata_struct.enums:
        return metadata_struct
    elements = {
        1: "ONE",
        2: "TWO",
        4: "FOUR",
    }
    structured_annotations = [
        _fbthrift_metadata.ThriftConstStruct(type=_fbthrift_metadata.ThriftStructType(name="thrift.BitmaskEnum"), fields= {  }),
    ]
    enum_dict = dict(metadata_struct.enums)
    enum_dict[qualified_name] = _fbthrift_metadata.ThriftEnum(name=qualified_name, elements=elements, structured_annotations=structured_annotations)
    new_struct = metadata_struct(enums=enum_dict)

    return new_struct

def gen_metadata_enum_MyBitmaskEnum2() -> _fbthrift_metadata.ThriftMetadata:
    return _fbthrift_gen_metadata_enum_MyBitmaskEnum2(_fbthrift_metadata.ThriftMetadata(structs={}, enums={}, exceptions={}, services={}))

def getThriftModuleMetadata() -> _fbthrift_metadata.ThriftMetadata:
    meta = _fbthrift_metadata.ThriftMetadata(structs={}, enums={}, exceptions={}, services={})
    meta = _fbthrift_gen_metadata_enum_Metasyntactic(meta)
    meta = _fbthrift_gen_metadata_enum_MyEnum1(meta)
    meta = _fbthrift_gen_metadata_enum_MyEnum2(meta)
    meta = _fbthrift_gen_metadata_enum_MyEnum3(meta)
    meta = _fbthrift_gen_metadata_enum_MyEnum4(meta)
    meta = _fbthrift_gen_metadata_enum_MyBitmaskEnum1(meta)
    meta = _fbthrift_gen_metadata_enum_MyBitmaskEnum2(meta)
    meta = _fbthrift_gen_metadata_struct_SomeStruct(meta)
    meta = _fbthrift_gen_metadata_struct_MyStruct(meta)
    return meta
