<?hh
/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */

/**
 * Original thrift enum:-
 * Enum
 */
enum Enum: int {
  ENUM = 1;
}

class Enum_TEnumStaticMetadata implements \IThriftEnumStaticMetadata {
  public static function getEnumMetadata()[]: \tmeta_ThriftEnum {
    return tmeta_ThriftEnum::fromShape(
      shape(
        "name" => "module.Enum",
        "elements" => dict[
          1 => "ENUM",
        ],
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TEnumAnnotations {
    return shape(
      'enum' => dict[],
      'constants' => dict[
      ],
    );
  }
}

/**
 * Original thrift struct:-
 * A
 */
class A implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'a',
      'type' => \TType::STRING,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'a' => 1,
  ];

  const type TConstructorShape = shape(
    ?'a' => ?string,
  );

  const type TShape = shape(
    'a' => string,
    ...
  );
  const int STRUCTURAL_ID = 7939807933046472325;
  /**
   * Original thrift field:-
   * 1: string a
   */
  public string $a;

  public function __construct(?string $a = null)[] {
    $this->a = $a ?? '';
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'a'),
    );
  }

  public function getName()[]: string {
    return 'A';
  }

  public function clearTerseFields()[write_props]: void {
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.A",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "a",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public static function __stringifyMapKeys<T>(dict<arraykey, T> $m)[]: dict<string, T> {
    return Dict\map_keys($m, $key ==> (string)$key);
  }

  public static function __fromShape(self::TShape $shape)[]: this {
    return new static(
      $shape['a'],
    );
  }

  public function __toShape()[]: self::TShape {
    return shape(
      'a' => $this->a,
    );
  }
  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

/**
 * Original thrift struct:-
 * B
 */
class B implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'just_an_A',
      'type' => \TType::STRUCT,
      'class' => A::class,
    ),
    2 => shape(
      'var' => 'set_of_i32',
      'type' => \TType::SET,
      'etype' => \TType::I32,
      'elem' => shape(
        'type' => \TType::I32,
      ),
      'format' => 'collection',
    ),
    3 => shape(
      'var' => 'list_of_i32',
      'type' => \TType::LST,
      'etype' => \TType::I32,
      'elem' => shape(
        'type' => \TType::I32,
      ),
      'format' => 'collection',
    ),
    4 => shape(
      'var' => 'list_of_string',
      'type' => \TType::LST,
      'etype' => \TType::STRING,
      'elem' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
    5 => shape(
      'var' => 'map_of_string_to_i32',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::I32,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::I32,
      ),
      'format' => 'collection',
    ),
    6 => shape(
      'var' => 'map_of_string_to_A',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRUCT,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRUCT,
        'class' => A::class,
      ),
      'format' => 'collection',
    ),
    7 => shape(
      'var' => 'map_of_string_to_list_of_i32',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::LST,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::LST,
        'etype' => \TType::I32,
        'elem' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    8 => shape(
      'var' => 'map_of_string_to_list_of_A',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::LST,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::LST,
        'etype' => \TType::STRUCT,
        'elem' => shape(
          'type' => \TType::STRUCT,
          'class' => A::class,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    9 => shape(
      'var' => 'map_of_string_to_set_of_i32',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::SET,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::SET,
        'etype' => \TType::I32,
        'elem' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    10 => shape(
      'var' => 'map_of_string_to_map_of_string_to_i32',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::MAP,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::STRING,
        'vtype' => \TType::I32,
        'key' => shape(
          'type' => \TType::STRING,
        ),
        'val' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    11 => shape(
      'var' => 'map_of_string_to_map_of_string_to_A',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::MAP,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::STRING,
        'vtype' => \TType::STRUCT,
        'key' => shape(
          'type' => \TType::STRING,
        ),
        'val' => shape(
          'type' => \TType::STRUCT,
          'class' => A::class,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    12 => shape(
      'var' => 'list_of_set_of_i32',
      'type' => \TType::LST,
      'etype' => \TType::SET,
      'elem' => shape(
        'type' => \TType::SET,
        'etype' => \TType::I32,
        'elem' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    13 => shape(
      'var' => 'list_of_map_of_string_to_list_of_A',
      'type' => \TType::LST,
      'etype' => \TType::MAP,
      'elem' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::STRING,
        'vtype' => \TType::LST,
        'key' => shape(
          'type' => \TType::STRING,
        ),
        'val' => shape(
          'type' => \TType::LST,
          'etype' => \TType::STRUCT,
          'elem' => shape(
            'type' => \TType::STRUCT,
            'class' => A::class,
          ),
          'format' => 'collection',
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    14 => shape(
      'var' => 'list_of_map_of_string_to_A',
      'type' => \TType::LST,
      'etype' => \TType::MAP,
      'elem' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::STRING,
        'vtype' => \TType::STRUCT,
        'key' => shape(
          'type' => \TType::STRING,
        ),
        'val' => shape(
          'type' => \TType::STRUCT,
          'class' => A::class,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    17 => shape(
      'var' => 'just_an_enum',
      'type' => \TType::I32,
      'enum' => Enum::class,
    ),
    51 => shape(
      'var' => 'optional_just_an_A',
      'type' => \TType::STRUCT,
      'class' => A::class,
    ),
    52 => shape(
      'var' => 'optional_set_of_i32',
      'type' => \TType::SET,
      'etype' => \TType::I32,
      'elem' => shape(
        'type' => \TType::I32,
      ),
      'format' => 'collection',
    ),
    53 => shape(
      'var' => 'optional_list_of_i32',
      'type' => \TType::LST,
      'etype' => \TType::I32,
      'elem' => shape(
        'type' => \TType::I32,
      ),
      'format' => 'collection',
    ),
    54 => shape(
      'var' => 'optional_list_of_string',
      'type' => \TType::LST,
      'etype' => \TType::STRING,
      'elem' => shape(
        'type' => \TType::STRING,
      ),
      'format' => 'collection',
    ),
    55 => shape(
      'var' => 'optional_map_of_string_to_i32',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::I32,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::I32,
      ),
      'format' => 'collection',
    ),
    56 => shape(
      'var' => 'optional_map_of_string_to_A',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::STRUCT,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::STRUCT,
        'class' => A::class,
      ),
      'format' => 'collection',
    ),
    57 => shape(
      'var' => 'optional_map_of_string_to_list_of_i32',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::LST,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::LST,
        'etype' => \TType::I32,
        'elem' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    58 => shape(
      'var' => 'optional_map_of_string_to_list_of_A',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::LST,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::LST,
        'etype' => \TType::STRUCT,
        'elem' => shape(
          'type' => \TType::STRUCT,
          'class' => A::class,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    59 => shape(
      'var' => 'optional_map_of_string_to_set_of_i32',
      'type' => \TType::MAP,
      'ktype' => \TType::STRING,
      'vtype' => \TType::SET,
      'key' => shape(
        'type' => \TType::STRING,
      ),
      'val' => shape(
        'type' => \TType::SET,
        'etype' => \TType::I32,
        'elem' => shape(
          'type' => \TType::I32,
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    60 => shape(
      'var' => 'optional_enum',
      'type' => \TType::I32,
      'enum' => Enum::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'just_an_A' => 1,
    'set_of_i32' => 2,
    'list_of_i32' => 3,
    'list_of_string' => 4,
    'map_of_string_to_i32' => 5,
    'map_of_string_to_A' => 6,
    'map_of_string_to_list_of_i32' => 7,
    'map_of_string_to_list_of_A' => 8,
    'map_of_string_to_set_of_i32' => 9,
    'map_of_string_to_map_of_string_to_i32' => 10,
    'map_of_string_to_map_of_string_to_A' => 11,
    'list_of_set_of_i32' => 12,
    'list_of_map_of_string_to_list_of_A' => 13,
    'list_of_map_of_string_to_A' => 14,
    'just_an_enum' => 17,
    'optional_just_an_A' => 51,
    'optional_set_of_i32' => 52,
    'optional_list_of_i32' => 53,
    'optional_list_of_string' => 54,
    'optional_map_of_string_to_i32' => 55,
    'optional_map_of_string_to_A' => 56,
    'optional_map_of_string_to_list_of_i32' => 57,
    'optional_map_of_string_to_list_of_A' => 58,
    'optional_map_of_string_to_set_of_i32' => 59,
    'optional_enum' => 60,
  ];

  const type TConstructorShape = shape(
    ?'just_an_A' => ?A,
    ?'set_of_i32' => ?Set<int>,
    ?'list_of_i32' => ?Vector<int>,
    ?'list_of_string' => ?Vector<string>,
    ?'map_of_string_to_i32' => ?Map<string, int>,
    ?'map_of_string_to_A' => ?Map<string, A>,
    ?'map_of_string_to_list_of_i32' => ?Map<string, Vector<int>>,
    ?'map_of_string_to_list_of_A' => ?Map<string, Vector<A>>,
    ?'map_of_string_to_set_of_i32' => ?Map<string, Set<int>>,
    ?'map_of_string_to_map_of_string_to_i32' => ?Map<string, Map<string, int>>,
    ?'map_of_string_to_map_of_string_to_A' => ?Map<string, Map<string, A>>,
    ?'list_of_set_of_i32' => ?Vector<Set<int>>,
    ?'list_of_map_of_string_to_list_of_A' => ?Vector<Map<string, Vector<A>>>,
    ?'list_of_map_of_string_to_A' => ?Vector<Map<string, A>>,
    ?'just_an_enum' => ?Enum,
    ?'optional_just_an_A' => ?A,
    ?'optional_set_of_i32' => ?Set<int>,
    ?'optional_list_of_i32' => ?Vector<int>,
    ?'optional_list_of_string' => ?Vector<string>,
    ?'optional_map_of_string_to_i32' => ?Map<string, int>,
    ?'optional_map_of_string_to_A' => ?Map<string, A>,
    ?'optional_map_of_string_to_list_of_i32' => ?Map<string, Vector<int>>,
    ?'optional_map_of_string_to_list_of_A' => ?Map<string, Vector<A>>,
    ?'optional_map_of_string_to_set_of_i32' => ?Map<string, Set<int>>,
    ?'optional_enum' => ?Enum,
  );

  const type TShape = shape(
    ?'just_an_A' => ?A::TShape,
    'set_of_i32' => dict<int, bool>,
    'list_of_i32' => vec<int>,
    'list_of_string' => vec<string>,
    'map_of_string_to_i32' => dict<arraykey, int>,
    'map_of_string_to_A' => dict<arraykey, A::TShape>,
    'map_of_string_to_list_of_i32' => dict<arraykey, vec<int>>,
    'map_of_string_to_list_of_A' => dict<arraykey, vec<A::TShape>>,
    'map_of_string_to_set_of_i32' => dict<arraykey, dict<int, bool>>,
    'map_of_string_to_map_of_string_to_i32' => dict<arraykey, dict<arraykey, int>>,
    'map_of_string_to_map_of_string_to_A' => dict<arraykey, dict<arraykey, A::TShape>>,
    'list_of_set_of_i32' => vec<dict<int, bool>>,
    'list_of_map_of_string_to_list_of_A' => vec<dict<arraykey, vec<A::TShape>>>,
    'list_of_map_of_string_to_A' => vec<dict<arraykey, A::TShape>>,
    ?'just_an_enum' => ?Enum,
    ?'optional_just_an_A' => ?A::TShape,
    ?'optional_set_of_i32' => ?dict<int, bool>,
    ?'optional_list_of_i32' => ?vec<int>,
    ?'optional_list_of_string' => ?vec<string>,
    ?'optional_map_of_string_to_i32' => ?dict<arraykey, int>,
    ?'optional_map_of_string_to_A' => ?dict<arraykey, A::TShape>,
    ?'optional_map_of_string_to_list_of_i32' => ?dict<arraykey, vec<int>>,
    ?'optional_map_of_string_to_list_of_A' => ?dict<arraykey, vec<A::TShape>>,
    ?'optional_map_of_string_to_set_of_i32' => ?dict<arraykey, dict<int, bool>>,
    ?'optional_enum' => ?Enum,
    ...
  );
  const int STRUCTURAL_ID = 5253870888365642604;
  /**
   * Original thrift field:-
   * 1: module.A just_an_A
   */
  public ?A $just_an_A;
  /**
   * Original thrift field:-
   * 2: set<i32> set_of_i32
   */
  public Set<int> $set_of_i32;
  /**
   * Original thrift field:-
   * 3: list<i32> list_of_i32
   */
  public Vector<int> $list_of_i32;
  /**
   * Original thrift field:-
   * 4: list<string> list_of_string
   */
  public Vector<string> $list_of_string;
  /**
   * Original thrift field:-
   * 5: map<string, i32> map_of_string_to_i32
   */
  public Map<string, int> $map_of_string_to_i32;
  /**
   * Original thrift field:-
   * 6: map<string, module.A> map_of_string_to_A
   */
  public Map<string, A> $map_of_string_to_A;
  /**
   * Original thrift field:-
   * 7: map<string, list<i32>> map_of_string_to_list_of_i32
   */
  public Map<string, Vector<int>> $map_of_string_to_list_of_i32;
  /**
   * Original thrift field:-
   * 8: map<string, list<module.A>> map_of_string_to_list_of_A
   */
  public Map<string, Vector<A>> $map_of_string_to_list_of_A;
  /**
   * Original thrift field:-
   * 9: map<string, set<i32>> map_of_string_to_set_of_i32
   */
  public Map<string, Set<int>> $map_of_string_to_set_of_i32;
  /**
   * Original thrift field:-
   * 10: map<string, map<string, i32>> map_of_string_to_map_of_string_to_i32
   */
  public Map<string, Map<string, int>> $map_of_string_to_map_of_string_to_i32;
  /**
   * Original thrift field:-
   * 11: map<string, map<string, module.A>> map_of_string_to_map_of_string_to_A
   */
  public Map<string, Map<string, A>> $map_of_string_to_map_of_string_to_A;
  /**
   * Original thrift field:-
   * 12: list<set<i32>> list_of_set_of_i32
   */
  public Vector<Set<int>> $list_of_set_of_i32;
  /**
   * Original thrift field:-
   * 13: list<map<string, list<module.A>>> list_of_map_of_string_to_list_of_A
   */
  public Vector<Map<string, Vector<A>>> $list_of_map_of_string_to_list_of_A;
  /**
   * Original thrift field:-
   * 14: list<map<string, module.A>> list_of_map_of_string_to_A
   */
  public Vector<Map<string, A>> $list_of_map_of_string_to_A;
  /**
   * Original thrift field:-
   * 17: module.Enum just_an_enum
   */
  public ?Enum $just_an_enum;
  /**
   * Original thrift field:-
   * 51: module.A optional_just_an_A
   */
  public ?A $optional_just_an_A;
  /**
   * Original thrift field:-
   * 52: set<i32> optional_set_of_i32
   */
  public ?Set<int> $optional_set_of_i32;
  /**
   * Original thrift field:-
   * 53: list<i32> optional_list_of_i32
   */
  public ?Vector<int> $optional_list_of_i32;
  /**
   * Original thrift field:-
   * 54: list<string> optional_list_of_string
   */
  public ?Vector<string> $optional_list_of_string;
  /**
   * Original thrift field:-
   * 55: map<string, i32> optional_map_of_string_to_i32
   */
  public ?Map<string, int> $optional_map_of_string_to_i32;
  /**
   * Original thrift field:-
   * 56: map<string, module.A> optional_map_of_string_to_A
   */
  public ?Map<string, A> $optional_map_of_string_to_A;
  /**
   * Original thrift field:-
   * 57: map<string, list<i32>> optional_map_of_string_to_list_of_i32
   */
  public ?Map<string, Vector<int>> $optional_map_of_string_to_list_of_i32;
  /**
   * Original thrift field:-
   * 58: map<string, list<module.A>> optional_map_of_string_to_list_of_A
   */
  public ?Map<string, Vector<A>> $optional_map_of_string_to_list_of_A;
  /**
   * Original thrift field:-
   * 59: map<string, set<i32>> optional_map_of_string_to_set_of_i32
   */
  public ?Map<string, Set<int>> $optional_map_of_string_to_set_of_i32;
  /**
   * Original thrift field:-
   * 60: module.Enum optional_enum
   */
  public ?Enum $optional_enum;

  public function __construct(?A $just_an_A = null, ?Set<int> $set_of_i32 = null, ?Vector<int> $list_of_i32 = null, ?Vector<string> $list_of_string = null, ?Map<string, int> $map_of_string_to_i32 = null, ?Map<string, A> $map_of_string_to_A = null, ?Map<string, Vector<int>> $map_of_string_to_list_of_i32 = null, ?Map<string, Vector<A>> $map_of_string_to_list_of_A = null, ?Map<string, Set<int>> $map_of_string_to_set_of_i32 = null, ?Map<string, Map<string, int>> $map_of_string_to_map_of_string_to_i32 = null, ?Map<string, Map<string, A>> $map_of_string_to_map_of_string_to_A = null, ?Vector<Set<int>> $list_of_set_of_i32 = null, ?Vector<Map<string, Vector<A>>> $list_of_map_of_string_to_list_of_A = null, ?Vector<Map<string, A>> $list_of_map_of_string_to_A = null, ?Enum $just_an_enum = null, ?A $optional_just_an_A = null, ?Set<int> $optional_set_of_i32 = null, ?Vector<int> $optional_list_of_i32 = null, ?Vector<string> $optional_list_of_string = null, ?Map<string, int> $optional_map_of_string_to_i32 = null, ?Map<string, A> $optional_map_of_string_to_A = null, ?Map<string, Vector<int>> $optional_map_of_string_to_list_of_i32 = null, ?Map<string, Vector<A>> $optional_map_of_string_to_list_of_A = null, ?Map<string, Set<int>> $optional_map_of_string_to_set_of_i32 = null, ?Enum $optional_enum = null)[] {
    $this->just_an_A = $just_an_A;
    $this->set_of_i32 = $set_of_i32 ?? Set {};
    $this->list_of_i32 = $list_of_i32 ?? Vector {};
    $this->list_of_string = $list_of_string ?? Vector {};
    $this->map_of_string_to_i32 = $map_of_string_to_i32 ?? Map {};
    $this->map_of_string_to_A = $map_of_string_to_A ?? Map {};
    $this->map_of_string_to_list_of_i32 = $map_of_string_to_list_of_i32 ?? Map {};
    $this->map_of_string_to_list_of_A = $map_of_string_to_list_of_A ?? Map {};
    $this->map_of_string_to_set_of_i32 = $map_of_string_to_set_of_i32 ?? Map {};
    $this->map_of_string_to_map_of_string_to_i32 = $map_of_string_to_map_of_string_to_i32 ?? Map {};
    $this->map_of_string_to_map_of_string_to_A = $map_of_string_to_map_of_string_to_A ?? Map {};
    $this->list_of_set_of_i32 = $list_of_set_of_i32 ?? Vector {};
    $this->list_of_map_of_string_to_list_of_A = $list_of_map_of_string_to_list_of_A ?? Vector {};
    $this->list_of_map_of_string_to_A = $list_of_map_of_string_to_A ?? Vector {};
    $this->just_an_enum = $just_an_enum;
    $this->optional_just_an_A = $optional_just_an_A;
    $this->optional_set_of_i32 = $optional_set_of_i32;
    $this->optional_list_of_i32 = $optional_list_of_i32;
    $this->optional_list_of_string = $optional_list_of_string;
    $this->optional_map_of_string_to_i32 = $optional_map_of_string_to_i32;
    $this->optional_map_of_string_to_A = $optional_map_of_string_to_A;
    $this->optional_map_of_string_to_list_of_i32 = $optional_map_of_string_to_list_of_i32;
    $this->optional_map_of_string_to_list_of_A = $optional_map_of_string_to_list_of_A;
    $this->optional_map_of_string_to_set_of_i32 = $optional_map_of_string_to_set_of_i32;
    $this->optional_enum = $optional_enum;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'just_an_A'),
      Shapes::idx($shape, 'set_of_i32'),
      Shapes::idx($shape, 'list_of_i32'),
      Shapes::idx($shape, 'list_of_string'),
      Shapes::idx($shape, 'map_of_string_to_i32'),
      Shapes::idx($shape, 'map_of_string_to_A'),
      Shapes::idx($shape, 'map_of_string_to_list_of_i32'),
      Shapes::idx($shape, 'map_of_string_to_list_of_A'),
      Shapes::idx($shape, 'map_of_string_to_set_of_i32'),
      Shapes::idx($shape, 'map_of_string_to_map_of_string_to_i32'),
      Shapes::idx($shape, 'map_of_string_to_map_of_string_to_A'),
      Shapes::idx($shape, 'list_of_set_of_i32'),
      Shapes::idx($shape, 'list_of_map_of_string_to_list_of_A'),
      Shapes::idx($shape, 'list_of_map_of_string_to_A'),
      Shapes::idx($shape, 'just_an_enum'),
      Shapes::idx($shape, 'optional_just_an_A'),
      Shapes::idx($shape, 'optional_set_of_i32'),
      Shapes::idx($shape, 'optional_list_of_i32'),
      Shapes::idx($shape, 'optional_list_of_string'),
      Shapes::idx($shape, 'optional_map_of_string_to_i32'),
      Shapes::idx($shape, 'optional_map_of_string_to_A'),
      Shapes::idx($shape, 'optional_map_of_string_to_list_of_i32'),
      Shapes::idx($shape, 'optional_map_of_string_to_list_of_A'),
      Shapes::idx($shape, 'optional_map_of_string_to_set_of_i32'),
      Shapes::idx($shape, 'optional_enum'),
    );
  }

  public function getName()[]: string {
    return 'B';
  }

  public function clearTerseFields()[write_props]: void {
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.B",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.A",
                    )
                  ),
                )
              ),
              "name" => "just_an_A",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "set_of_i32",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "list_of_i32",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 4,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "list_of_string",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 5,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "map_of_string_to_i32",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 6,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "module.A",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "map_of_string_to_A",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 7,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_list" => tmeta_ThriftListType::fromShape(
                            shape(
                              "valueType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "map_of_string_to_list_of_i32",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 8,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_list" => tmeta_ThriftListType::fromShape(
                            shape(
                              "valueType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_struct" => tmeta_ThriftStructType::fromShape(
                                    shape(
                                      "name" => "module.A",
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "map_of_string_to_list_of_A",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 9,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_set" => tmeta_ThriftSetType::fromShape(
                            shape(
                              "valueType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "map_of_string_to_set_of_i32",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 10,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                )
                              ),
                              "valueType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "map_of_string_to_map_of_string_to_i32",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 11,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                )
                              ),
                              "valueType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_struct" => tmeta_ThriftStructType::fromShape(
                                    shape(
                                      "name" => "module.A",
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "map_of_string_to_map_of_string_to_A",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 12,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_set" => tmeta_ThriftSetType::fromShape(
                            shape(
                              "valueType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "list_of_set_of_i32",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 13,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                )
                              ),
                              "valueType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_list" => tmeta_ThriftListType::fromShape(
                                    shape(
                                      "valueType" => tmeta_ThriftType::fromShape(
                                        shape(
                                          "t_struct" => tmeta_ThriftStructType::fromShape(
                                            shape(
                                              "name" => "module.A",
                                            )
                                          ),
                                        )
                                      ),
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "list_of_map_of_string_to_list_of_A",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 14,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                )
                              ),
                              "valueType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_struct" => tmeta_ThriftStructType::fromShape(
                                    shape(
                                      "name" => "module.A",
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "list_of_map_of_string_to_A",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 17,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.Enum",
                    )
                  ),
                )
              ),
              "name" => "just_an_enum",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 51,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.A",
                    )
                  ),
                )
              ),
              "name" => "optional_just_an_A",
              "is_optional" => true,
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 52,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optional_set_of_i32",
              "is_optional" => true,
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 53,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optional_list_of_i32",
              "is_optional" => true,
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 54,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optional_list_of_string",
              "is_optional" => true,
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 55,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optional_map_of_string_to_i32",
              "is_optional" => true,
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 56,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_struct" => tmeta_ThriftStructType::fromShape(
                            shape(
                              "name" => "module.A",
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optional_map_of_string_to_A",
              "is_optional" => true,
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 57,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_list" => tmeta_ThriftListType::fromShape(
                            shape(
                              "valueType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optional_map_of_string_to_list_of_i32",
              "is_optional" => true,
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 58,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_list" => tmeta_ThriftListType::fromShape(
                            shape(
                              "valueType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_struct" => tmeta_ThriftStructType::fromShape(
                                    shape(
                                      "name" => "module.A",
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optional_map_of_string_to_list_of_A",
              "is_optional" => true,
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 59,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_map" => tmeta_ThriftMapType::fromShape(
                    shape(
                      "keyType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                        )
                      ),
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_set" => tmeta_ThriftSetType::fromShape(
                            shape(
                              "valueType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "optional_map_of_string_to_set_of_i32",
              "is_optional" => true,
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 60,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.Enum",
                    )
                  ),
                )
              ),
              "name" => "optional_enum",
              "is_optional" => true,
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public static function __stringifyMapKeys<T>(dict<arraykey, T> $m)[]: dict<string, T> {
    return Dict\map_keys($m, $key ==> (string)$key);
  }

  public static function __fromShape(self::TShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'just_an_A') === null ? null : (A::__fromShape($shape['just_an_A'])),
      new Set(Keyset\keys($shape['set_of_i32'])),
      $shape['list_of_i32'] |> new Vector($$),
      $shape['list_of_string'] |> new Vector($$),
      $shape['map_of_string_to_i32']
        |> self::__stringifyMapKeys($$) |> new Map($$),
      $shape['map_of_string_to_A']
        |> Dict\map(
          self::__stringifyMapKeys($$),
          $_val0 ==> $_val0
            |> A::__fromShape($$),
        ) |> new Map($$),
      $shape['map_of_string_to_list_of_i32']
        |> Dict\map(
          self::__stringifyMapKeys($$),
          $_val1 ==> $_val1 |> new Vector($$),
        ) |> new Map($$),
      $shape['map_of_string_to_list_of_A']
        |> Dict\map(
          self::__stringifyMapKeys($$),
          $_val3 ==> $_val3
            |> Vec\map(
              $$,
              $_val2 ==> $_val2
                |> A::__fromShape($$),
            ) |> new Vector($$),
        ) |> new Map($$),
      $shape['map_of_string_to_set_of_i32']
        |> Dict\map(
          self::__stringifyMapKeys($$),
          $_val4 ==> $_val4
            |> new Set(Keyset\keys($$)),
        ) |> new Map($$),
      $shape['map_of_string_to_map_of_string_to_i32']
        |> Dict\map(
          self::__stringifyMapKeys($$),
          $_val5 ==> $_val5
            |> self::__stringifyMapKeys($$) |> new Map($$),
        ) |> new Map($$),
      $shape['map_of_string_to_map_of_string_to_A']
        |> Dict\map(
          self::__stringifyMapKeys($$),
          $_val7 ==> $_val7
            |> Dict\map(
              self::__stringifyMapKeys($$),
              $_val6 ==> $_val6
                |> A::__fromShape($$),
            ) |> new Map($$),
        ) |> new Map($$),
      $shape['list_of_set_of_i32']
        |> Vec\map(
          $$,
          $_val8 ==> $_val8
            |> new Set(Keyset\keys($$)),
        ) |> new Vector($$),
      $shape['list_of_map_of_string_to_list_of_A']
        |> Vec\map(
          $$,
          $_val11 ==> $_val11
            |> Dict\map(
              self::__stringifyMapKeys($$),
              $_val10 ==> $_val10
                |> Vec\map(
                  $$,
                  $_val9 ==> $_val9
                    |> A::__fromShape($$),
                ) |> new Vector($$),
            ) |> new Map($$),
        ) |> new Vector($$),
      $shape['list_of_map_of_string_to_A']
        |> Vec\map(
          $$,
          $_val13 ==> $_val13
            |> Dict\map(
              self::__stringifyMapKeys($$),
              $_val12 ==> $_val12
                |> A::__fromShape($$),
            ) |> new Map($$),
        ) |> new Vector($$),
      Shapes::idx($shape, 'just_an_enum'),
      Shapes::idx($shape, 'optional_just_an_A') === null ? null : (A::__fromShape($shape['optional_just_an_A'])),
      Shapes::idx($shape, 'optional_set_of_i32') === null ? null : (new Set(Keyset\keys($shape['optional_set_of_i32']))),
      Shapes::idx($shape, 'optional_list_of_i32') === null ? null : ($shape['optional_list_of_i32'] |> new Vector($$)),
      Shapes::idx($shape, 'optional_list_of_string') === null ? null : ($shape['optional_list_of_string'] |> new Vector($$)),
      Shapes::idx($shape, 'optional_map_of_string_to_i32') === null ? null : ($shape['optional_map_of_string_to_i32']
        |> self::__stringifyMapKeys($$) |> new Map($$)),
      Shapes::idx($shape, 'optional_map_of_string_to_A') === null ? null : ($shape['optional_map_of_string_to_A']
        |> Dict\map(
          self::__stringifyMapKeys($$),
          $_val14 ==> $_val14
            |> A::__fromShape($$),
        ) |> new Map($$)),
      Shapes::idx($shape, 'optional_map_of_string_to_list_of_i32') === null ? null : ($shape['optional_map_of_string_to_list_of_i32']
        |> Dict\map(
          self::__stringifyMapKeys($$),
          $_val15 ==> $_val15 |> new Vector($$),
        ) |> new Map($$)),
      Shapes::idx($shape, 'optional_map_of_string_to_list_of_A') === null ? null : ($shape['optional_map_of_string_to_list_of_A']
        |> Dict\map(
          self::__stringifyMapKeys($$),
          $_val17 ==> $_val17
            |> Vec\map(
              $$,
              $_val16 ==> $_val16
                |> A::__fromShape($$),
            ) |> new Vector($$),
        ) |> new Map($$)),
      Shapes::idx($shape, 'optional_map_of_string_to_set_of_i32') === null ? null : ($shape['optional_map_of_string_to_set_of_i32']
        |> Dict\map(
          self::__stringifyMapKeys($$),
          $_val18 ==> $_val18
            |> new Set(Keyset\keys($$)),
        ) |> new Map($$)),
      Shapes::idx($shape, 'optional_enum'),
    );
  }

  public function __toShape()[]: self::TShape {
    return shape(
      'just_an_A' => $this->just_an_A?->__toShape(),
      'set_of_i32' => ThriftUtil::toDArray(Dict\fill_keys($this->set_of_i32->toValuesArray(), true), static::class),
      'list_of_i32' => vec($this->list_of_i32),
      'list_of_string' => vec($this->list_of_string),
      'map_of_string_to_i32' => dict($this->map_of_string_to_i32),
      'map_of_string_to_A' => $this->map_of_string_to_A->map(
        ($_val0) ==> $_val0->__toShape(),
      )
        |> dict($$),
      'map_of_string_to_list_of_i32' => $this->map_of_string_to_list_of_i32->map(
        ($_val0) ==> vec($_val0),
      )
        |> dict($$),
      'map_of_string_to_list_of_A' => $this->map_of_string_to_list_of_A->map(
        ($_val0) ==> $_val0->map(
          ($_val1) ==> $_val1->__toShape(),
        )
          |> vec($$),
      )
        |> dict($$),
      'map_of_string_to_set_of_i32' => $this->map_of_string_to_set_of_i32->map(
        ($_val0) ==> ThriftUtil::toDArray(Dict\fill_keys($_val0, true), static::class),
      )
        |> dict($$),
      'map_of_string_to_map_of_string_to_i32' => $this->map_of_string_to_map_of_string_to_i32->map(
        ($_val0) ==> dict($_val0),
      )
        |> dict($$),
      'map_of_string_to_map_of_string_to_A' => $this->map_of_string_to_map_of_string_to_A->map(
        ($_val0) ==> $_val0->map(
          ($_val1) ==> $_val1->__toShape(),
        )
          |> dict($$),
      )
        |> dict($$),
      'list_of_set_of_i32' => $this->list_of_set_of_i32->map(
        ($_val0) ==> ThriftUtil::toDArray(Dict\fill_keys($_val0, true), static::class),
      )
        |> vec($$),
      'list_of_map_of_string_to_list_of_A' => $this->list_of_map_of_string_to_list_of_A->map(
        ($_val0) ==> $_val0->map(
          ($_val1) ==> $_val1->map(
            ($_val2) ==> $_val2->__toShape(),
          )
            |> vec($$),
        )
          |> dict($$),
      )
        |> vec($$),
      'list_of_map_of_string_to_A' => $this->list_of_map_of_string_to_A->map(
        ($_val0) ==> $_val0->map(
          ($_val1) ==> $_val1->__toShape(),
        )
          |> dict($$),
      )
        |> vec($$),
      'just_an_enum' => $this->just_an_enum,
      'optional_just_an_A' => $this->optional_just_an_A?->__toShape(),
      'optional_set_of_i32' => $this->optional_set_of_i32
        |> $$ === null ? null : ThriftUtil::toDArray(Dict\fill_keys($$->toValuesArray(), true), static::class),
      'optional_list_of_i32' => $this->optional_list_of_i32
        |> $$ === null ? null : vec($$),
      'optional_list_of_string' => $this->optional_list_of_string
        |> $$ === null ? null : vec($$),
      'optional_map_of_string_to_i32' => $this->optional_map_of_string_to_i32
        |> $$ === null ? null : dict($$),
      'optional_map_of_string_to_A' => $this->optional_map_of_string_to_A?->map(
        ($_val0) ==> $_val0->__toShape(),
      )
        |> $$ === null ? null : dict($$),
      'optional_map_of_string_to_list_of_i32' => $this->optional_map_of_string_to_list_of_i32?->map(
        ($_val0) ==> vec($_val0),
      )
        |> $$ === null ? null : dict($$),
      'optional_map_of_string_to_list_of_A' => $this->optional_map_of_string_to_list_of_A?->map(
        ($_val0) ==> $_val0->map(
          ($_val1) ==> $_val1->__toShape(),
        )
          |> vec($$),
      )
        |> $$ === null ? null : dict($$),
      'optional_map_of_string_to_set_of_i32' => $this->optional_map_of_string_to_set_of_i32?->map(
        ($_val0) ==> ThriftUtil::toDArray(Dict\fill_keys($_val0, true), static::class),
      )
        |> $$ === null ? null : dict($$),
      'optional_enum' => $this->optional_enum,
    );
  }
  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}


<?hh
/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */

/**
 * Original thrift service:-
 * Bar
 */
interface BarAsyncIf extends \IThriftAsyncIf {
  /**
   * Original thrift definition:-
   * string
   *   baz(1: set<i32> a,
   *       2: list<map<i32, set<string>>> b,
   *       3: i64 c,
   *       4: Foo d,
   *       5: i64 e);
   */
  public function baz(Set<int> $a, KeyedContainer<int, KeyedContainer<int, Set<string>>> $b, int $c, ?Foo $d, int $e): Awaitable<string>;
}

/**
 * Original thrift service:-
 * Bar
 */
interface BarIf extends \IThriftSyncIf {
  /**
   * Original thrift definition:-
   * string
   *   baz(1: set<i32> a,
   *       2: list<map<i32, set<string>>> b,
   *       3: i64 c,
   *       4: Foo d,
   *       5: i64 e);
   */
  public function baz(Set<int> $a, KeyedContainer<int, KeyedContainer<int, Set<string>>> $b, int $c, ?Foo $d, int $e): string;
}

/**
 * Original thrift service:-
 * Bar
 */
interface BarAsyncClientIf extends BarAsyncIf {
}

/**
 * Original thrift service:-
 * Bar
 */
interface BarClientIf extends \IThriftSyncIf {
  /**
   * Original thrift definition:-
   * string
   *   baz(1: set<i32> a,
   *       2: list<map<i32, set<string>>> b,
   *       3: i64 c,
   *       4: Foo d,
   *       5: i64 e);
   */
  public function baz(Set<int> $a, KeyedContainer<int, KeyedContainer<int, Set<string>>> $b, int $c, ?Foo $d, int $e): Awaitable<string>;
}

/**
 * Original thrift service:-
 * Bar
 */
trait BarClientBase {
  require extends \ThriftClientBase;

}

class BarAsyncClient extends \ThriftClientBase implements BarAsyncClientIf {
  use BarClientBase;

  /**
   * Original thrift definition:-
   * string
   *   baz(1: set<i32> a,
   *       2: list<map<i32, set<string>>> b,
   *       3: i64 c,
   *       4: Foo d,
   *       5: i64 e);
   */
  public async function baz(Set<int> $a, KeyedContainer<int, KeyedContainer<int, Set<string>>> $b, int $c, ?Foo $d, int $e): Awaitable<string> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = Bar_baz_args::fromShape(shape(
      'a' => $a,
      'b' => (new Vector($b))->map(
        $_val0 ==> new Map($_val0)
      ),
      'c' => $c,
      'd' => $d,
      'e' => $e,
    ));
    await $this->asyncHandler_->genBefore("Bar", "baz", $args);
    $currentseqid = $this->sendImplHelper($args, "baz", false);
    return await $this->genAwaitResponse(Bar_baz_result::class, "baz", false, $currentseqid, $rpc_options);
  }

}

class BarClient extends \ThriftClientBase implements BarClientIf {
  use BarClientBase;

  /**
   * Original thrift definition:-
   * string
   *   baz(1: set<i32> a,
   *       2: list<map<i32, set<string>>> b,
   *       3: i64 c,
   *       4: Foo d,
   *       5: i64 e);
   */
  public async function baz(Set<int> $a, KeyedContainer<int, KeyedContainer<int, Set<string>>> $b, int $c, ?Foo $d, int $e): Awaitable<string> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = Bar_baz_args::fromShape(shape(
      'a' => $a,
      'b' => (new Vector($b))->map(
        $_val0 ==> new Map($_val0)
      ),
      'c' => $c,
      'd' => $d,
      'e' => $e,
    ));
    await $this->asyncHandler_->genBefore("Bar", "baz", $args);
    $currentseqid = $this->sendImplHelper($args, "baz", false);
    return await $this->genAwaitResponse(Bar_baz_result::class, "baz", false, $currentseqid, $rpc_options);
  }

  /* send and recv functions */
  public function send_baz(Set<int> $a, KeyedContainer<int, KeyedContainer<int, Set<string>>> $b, int $c, ?Foo $d, int $e): int {
    $args = Bar_baz_args::fromShape(shape(
      'a' => $a,
      'b' => (new Vector($b))->map(
        $_val0 ==> new Map($_val0)
      ),
      'c' => $c,
      'd' => $d,
      'e' => $e,
    ));
    return $this->sendImplHelper($args, "baz", false);
  }
  public function recv_baz(?int $expectedsequenceid = null): string {
    return $this->recvImplHelper(Bar_baz_result::class, "baz", false, $expectedsequenceid);
  }
}

// HELPER FUNCTIONS AND STRUCTURES

class Bar_baz_args implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'a',
      'type' => \TType::SET,
      'etype' => \TType::I32,
      'elem' => shape(
        'type' => \TType::I32,
      ),
      'format' => 'collection',
    ),
    2 => shape(
      'var' => 'b',
      'type' => \TType::LST,
      'etype' => \TType::MAP,
      'elem' => shape(
        'type' => \TType::MAP,
        'ktype' => \TType::I32,
        'vtype' => \TType::SET,
        'key' => shape(
          'type' => \TType::I32,
        ),
        'val' => shape(
          'type' => \TType::SET,
          'etype' => \TType::STRING,
          'elem' => shape(
            'type' => \TType::STRING,
          ),
          'format' => 'collection',
        ),
        'format' => 'collection',
      ),
      'format' => 'collection',
    ),
    3 => shape(
      'var' => 'c',
      'type' => \TType::I64,
    ),
    4 => shape(
      'var' => 'd',
      'type' => \TType::STRUCT,
      'class' => Foo::class,
    ),
    5 => shape(
      'var' => 'e',
      'type' => \TType::I64,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'a' => 1,
    'b' => 2,
    'c' => 3,
    'd' => 4,
    'e' => 5,
  ];

  const type TConstructorShape = shape(
    ?'a' => ?Set<int>,
    ?'b' => ?Vector<Map<int, Set<string>>>,
    ?'c' => ?int,
    ?'d' => ?Foo,
    ?'e' => ?int,
  );

  const int STRUCTURAL_ID = 7865027497865509792;
  public Set<int> $a;
  public Vector<Map<int, Set<string>>> $b;
  public int $c;
  public ?Foo $d;
  public int $e;

  public function __construct(?Set<int> $a = null, ?Vector<Map<int, Set<string>>> $b = null, ?int $c = null, ?Foo $d = null, ?int $e = null)[] {
    $this->a = $a ?? Set {};
    $this->b = $b ?? Vector {};
    $this->c = $c ?? 0;
    $this->d = $d;
    $this->e = $e ?? 4;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'a'),
      Shapes::idx($shape, 'b'),
      Shapes::idx($shape, 'c'),
      Shapes::idx($shape, 'd'),
      Shapes::idx($shape, 'e'),
    );
  }

  public function getName()[]: string {
    return 'Bar_baz_args';
  }

  public function clearTerseFields()[write_props]: void {
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.baz_args",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "a",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_list" => tmeta_ThriftListType::fromShape(
                    shape(
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_map" => tmeta_ThriftMapType::fromShape(
                            shape(
                              "keyType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                              "valueType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_set" => tmeta_ThriftSetType::fromShape(
                                    shape(
                                      "valueType" => tmeta_ThriftType::fromShape(
                                        shape(
                                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                        )
                                      ),
                                    )
                                  ),
                                )
                              ),
                            )
                          ),
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "b",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE,
                )
              ),
              "name" => "c",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 4,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.Foo",
                    )
                  ),
                )
              ),
              "name" => "d",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 5,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE,
                )
              ),
              "name" => "e",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class Bar_baz_result extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = string;

  const \ThriftStructTypes::TSpec SPEC = dict[
    0 => shape(
      'var' => 'success',
      'type' => \TType::STRING,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'success' => 0,
  ];

  const type TConstructorShape = shape(
    ?'success' => ?this::TResult,
  );

  const int STRUCTURAL_ID = 1365128170602685579;
  public ?this::TResult $success;

  public function __construct(?this::TResult $success = null)[] {
    $this->success = $success;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'success'),
    );
  }

  public function getName()[]: string {
    return 'Bar_baz_result';
  }

  public function clearTerseFields()[write_props]: void {
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.Bar_baz_result",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "success",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class BarStaticMetadata implements \IThriftServiceStaticMetadata {
  public static function getServiceMetadata()[]: \tmeta_ThriftService {
    return tmeta_ThriftService::fromShape(
      shape(
        "name" => "module.Bar",
        "functions" => vec[
          tmeta_ThriftFunction::fromShape(
            shape(
              "name" => "baz",
              "return_type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "arguments" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_set" => tmeta_ThriftSetType::fromShape(
                          shape(
                            "valueType" => tmeta_ThriftType::fromShape(
                              shape(
                                "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                              )
                            ),
                          )
                        ),
                      )
                    ),
                    "name" => "a",
                  )
                ),
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 2,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_list" => tmeta_ThriftListType::fromShape(
                          shape(
                            "valueType" => tmeta_ThriftType::fromShape(
                              shape(
                                "t_map" => tmeta_ThriftMapType::fromShape(
                                  shape(
                                    "keyType" => tmeta_ThriftType::fromShape(
                                      shape(
                                        "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                      )
                                    ),
                                    "valueType" => tmeta_ThriftType::fromShape(
                                      shape(
                                        "t_set" => tmeta_ThriftSetType::fromShape(
                                          shape(
                                            "valueType" => tmeta_ThriftType::fromShape(
                                              shape(
                                                "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                                              )
                                            ),
                                          )
                                        ),
                                      )
                                    ),
                                  )
                                ),
                              )
                            ),
                          )
                        ),
                      )
                    ),
                    "name" => "b",
                  )
                ),
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 3,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE,
                      )
                    ),
                    "name" => "c",
                  )
                ),
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 4,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_struct" => tmeta_ThriftStructType::fromShape(
                          shape(
                            "name" => "module.Foo",
                          )
                        ),
                      )
                    ),
                    "name" => "d",
                  )
                ),
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 5,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE,
                      )
                    ),
                    "name" => "e",
                  )
                ),
              ],
            )
          ),
        ],
      )
    );
  }

  public static function getServiceMetadataResponse()[]: \tmeta_ThriftServiceMetadataResponse {
    return \tmeta_ThriftServiceMetadataResponse::fromShape(
      shape(
        'context' => \tmeta_ThriftServiceContext::fromShape(
          shape(
            'service_info' => self::getServiceMetadata(),
            'module' => \tmeta_ThriftModuleContext::fromShape(
              shape(
                'name' => 'module',
              )
            ),
          )
        ),
        'metadata' => \tmeta_ThriftMetadata::fromShape(
          shape(
            'enums' => dict[
            ],
            'structs' => dict[
              'module.Foo' => Foo::getStructMetadata(),
            ],
            'exceptions' => dict[
            ],
            'services' => dict[
            ],
          )
        ),
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TServiceAnnotations {
    return shape(
      'service' => dict[],
      'functions' => dict[
      ],
    );
  }
}