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

/**
 * Detailed overview of service
 *
 * Original thrift service:-
 * C
 */
interface CAsyncIf extends \IThriftAsyncIf {
  /**
   * Function doctext.
   *
   * Original thrift definition:-
   * void
   *   f();
   */
  public function f(): Awaitable<void>;

  /**
   *
   * Original thrift definition:-
   * string
   *   thing(1: i32 a,
   *         2: string b,
   *         3: set<i32> c)
   *   throws (1: Bang bang);
   */
  public function thing(int $a, string $b, Set<int> $c): Awaitable<string>;
}

/**
 * Detailed overview of service
 *
 * Original thrift service:-
 * C
 */
interface CIf extends \IThriftSyncIf {
  /**
   * Function doctext.
   *
   * Original thrift definition:-
   * void
   *   f();
   */
  public function f(): void;

  /**
   *
   * Original thrift definition:-
   * string
   *   thing(1: i32 a,
   *         2: string b,
   *         3: set<i32> c)
   *   throws (1: Bang bang);
   */
  public function thing(int $a, string $b, Set<int> $c): string;
}

/**
 * Detailed overview of service
 *
 * Original thrift service:-
 * C
 */
interface CAsyncClientIf extends CAsyncIf {
  /**
   * Streaming function
   *
   * Original thrift definition:-
   * void, stream<number>
   *   numbers();
   */
  public function numbers(): Awaitable<\ResponseAndClientStream<null, int>>;
}

/**
 * Detailed overview of service
 *
 * Original thrift service:-
 * C
 */
interface CClientIf extends \IThriftSyncIf {
  /**
   * Function doctext.
   *
   * Original thrift definition:-
   * void
   *   f();
   */
  public function f(): Awaitable<void>;

  /**
   *
   * Original thrift definition:-
   * string
   *   thing(1: i32 a,
   *         2: string b,
   *         3: set<i32> c)
   *   throws (1: Bang bang);
   */
  public function thing(int $a, string $b, Set<int> $c): Awaitable<string>;

  /**
   * Streaming function
   *
   * Original thrift definition:-
   * void, stream<number>
   *   numbers();
   */
  public function numbers(): Awaitable<\ResponseAndClientStream<null, int>>;
}

/**
 * Detailed overview of service
 *
 * Original thrift service:-
 * C
 */
trait CClientBase {
  require extends \ThriftClientBase;

}

class CAsyncClient extends \ThriftClientBase implements CAsyncClientIf {
  use CClientBase;

  /**
   * Function doctext.
   *
   * Original thrift definition:-
   * void
   *   f();
   */
  public async function f(): Awaitable<void> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = C_f_args::withDefaultValues();
    await $this->asyncHandler_->genBefore("C", "f", $args);
    $currentseqid = $this->sendImplHelper($args, "f", false);
    await $this->genAwaitResponse(C_f_result::class, "f", true, $currentseqid, $rpc_options);
  }

  /**
   *
   * Original thrift definition:-
   * string
   *   thing(1: i32 a,
   *         2: string b,
   *         3: set<i32> c)
   *   throws (1: Bang bang);
   */
  public async function thing(int $a, string $b, Set<int> $c): 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 = C_thing_args::fromShape(shape(
      'a' => $a,
      'b' => $b,
      'c' => $c,
    ));
    await $this->asyncHandler_->genBefore("C", "thing", $args);
    $currentseqid = $this->sendImplHelper($args, "thing", false);
    return await $this->genAwaitResponse(C_thing_result::class, "thing", false, $currentseqid, $rpc_options);
  }

  /**
   * Streaming function
   *
   * Original thrift definition:-
   * void, stream<number>
   *   numbers();
   */
  public async function numbers(): Awaitable<\ResponseAndClientStream<null, int>> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = C_numbers_args::withDefaultValues();
    await $this->asyncHandler_->genBefore("C", "numbers", $args);
    $currentseqid = $this->sendImplHelper($args, "numbers", false);
    return await $this->genAwaitStreamResponse(C_numbers_FirstResponse::class, C_numbers_StreamResponse::class, "numbers", true, $currentseqid, $rpc_options);
  }

}

class CClient extends \ThriftClientBase implements CClientIf {
  use CClientBase;

  /**
   * Function doctext.
   *
   * Original thrift definition:-
   * void
   *   f();
   */
  public async function f(): Awaitable<void> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = C_f_args::withDefaultValues();
    await $this->asyncHandler_->genBefore("C", "f", $args);
    $currentseqid = $this->sendImplHelper($args, "f", false);
    await $this->genAwaitResponse(C_f_result::class, "f", true, $currentseqid, $rpc_options);
  }

  /**
   *
   * Original thrift definition:-
   * string
   *   thing(1: i32 a,
   *         2: string b,
   *         3: set<i32> c)
   *   throws (1: Bang bang);
   */
  public async function thing(int $a, string $b, Set<int> $c): 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 = C_thing_args::fromShape(shape(
      'a' => $a,
      'b' => $b,
      'c' => $c,
    ));
    await $this->asyncHandler_->genBefore("C", "thing", $args);
    $currentseqid = $this->sendImplHelper($args, "thing", false);
    return await $this->genAwaitResponse(C_thing_result::class, "thing", false, $currentseqid, $rpc_options);
  }

  /**
   * Streaming function
   *
   * Original thrift definition:-
   * void, stream<number>
   *   numbers();
   */
  public async function numbers(): Awaitable<\ResponseAndClientStream<null, int>> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = C_numbers_args::withDefaultValues();
    await $this->asyncHandler_->genBefore("C", "numbers", $args);
    $currentseqid = $this->sendImplHelper($args, "numbers", false);
    return await $this->genAwaitStreamResponse(C_numbers_FirstResponse::class, C_numbers_StreamResponse::class, "numbers", true, $currentseqid, $rpc_options);
  }

  /* send and recv functions */
  public function send_f(): int {
    $args = C_f_args::withDefaultValues();
    return $this->sendImplHelper($args, "f", false);
  }
  public function recv_f(?int $expectedsequenceid = null): void {
    $this->recvImplHelper(C_f_result::class, "f", true, $expectedsequenceid);
  }
  public function send_thing(int $a, string $b, Set<int> $c): int {
    $args = C_thing_args::fromShape(shape(
      'a' => $a,
      'b' => $b,
      'c' => $c,
    ));
    return $this->sendImplHelper($args, "thing", false);
  }
  public function recv_thing(?int $expectedsequenceid = null): string {
    return $this->recvImplHelper(C_thing_result::class, "thing", false, $expectedsequenceid);
  }
}

// HELPER FUNCTIONS AND STRUCTURES

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

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.f_args",
        "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 C_f_result extends \ThriftSyncStructWithoutResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.C_f_result",
        "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 C_thing_args implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'a',
      'type' => \TType::I32,
    ),
    2 => shape(
      'var' => 'b',
      'type' => \TType::STRING,
    ),
    3 => shape(
      'var' => 'c',
      'type' => \TType::SET,
      'etype' => \TType::I32,
      'elem' => shape(
        'type' => \TType::I32,
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'a' => 1,
    'b' => 2,
    'c' => 3,
  ];

  const type TConstructorShape = shape(
    ?'a' => ?int,
    ?'b' => ?string,
    ?'c' => ?Set<int>,
  );

  const int STRUCTURAL_ID = 5152653522450717322;
  public int $a;
  public string $b;
  public Set<int> $c;

  public function __construct(?int $a = null, ?string $b = null, ?Set<int> $c = null)[] {
    $this->a = $a ?? 0;
    $this->b = $b ?? '';
    $this->c = $c ?? Set {};
  }

  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'),
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.thing_args",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => 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_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "b",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "c",
            )
          ),
        ],
        "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 C_thing_result extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = string;

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

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

  const int STRUCTURAL_ID = 8456199022957829086;
  public ?this::TResult $success;
  public ?Bang $bang;

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

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

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

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.C_thing_result",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "success",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.Bang",
                    )
                  ),
                )
              ),
              "name" => "bang",
            )
          ),
        ],
        "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);
  }

  public function checkForException(): ?\TException {
    if ($this->bang !== null) {
      return $this->bang;
    }
    return null;
  }
}

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

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.numbers_args",
        "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 C_numbers_StreamResponse extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = int;

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

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

  const int STRUCTURAL_ID = 1815418233987567820;
  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 'C_numbers_StreamResponse';
  }

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.C_numbers_StreamResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_typedef" => tmeta_ThriftTypedefType::fromShape(
                    shape(
                      "name" => "module.number",
                      "underlyingType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_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 C_numbers_FirstResponse extends \ThriftSyncStructWithoutResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.C_numbers_FirstResponse",
        "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 CStaticMetadata implements \IThriftServiceStaticMetadata {
  public static function getServiceMetadata()[]: \tmeta_ThriftService {
    return tmeta_ThriftService::fromShape(
      shape(
        "name" => "module.C",
        "functions" => vec[
          tmeta_ThriftFunction::fromShape(
            shape(
              "name" => "f",
              "return_type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_VOID_TYPE,
                )
              ),
            )
          ),
          tmeta_ThriftFunction::fromShape(
            shape(
              "name" => "thing",
              "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_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                      )
                    ),
                    "name" => "a",
                  )
                ),
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 2,
                    "type" => 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_set" => tmeta_ThriftSetType::fromShape(
                          shape(
                            "valueType" => tmeta_ThriftType::fromShape(
                              shape(
                                "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                              )
                            ),
                          )
                        ),
                      )
                    ),
                    "name" => "c",
                  )
                ),
              ],
              "exceptions" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_struct" => tmeta_ThriftStructType::fromShape(
                          shape(
                            "name" => "module.Bang",
                          )
                        ),
                      )
                    ),
                    "name" => "bang",
                  )
                ),
              ],
            )
          ),
          tmeta_ThriftFunction::fromShape(
            shape(
              "name" => "numbers",
              "return_type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_stream" => tmeta_ThriftStreamType::fromShape(
                    shape(
                      "elemType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_typedef" => tmeta_ThriftTypedefType::fromShape(
                            shape(
                              "name" => "module.number",
                              "underlyingType" => tmeta_ThriftType::fromShape(
                                shape(
                                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                                )
                              ),
                            )
                          ),
                        )
                      ),
                      "initialResponseType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_VOID_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
            )
          ),
        ],
      )
    );
  }

  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[
            ],
            'exceptions' => dict[
              'module.Bang' => Bang::getExceptionMetadata(),
            ],
            'services' => dict[
            ],
          )
        ),
      )
    );
  }

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


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

class module_CONSTANTS implements \IThriftConstants {
  /**
   * Constant foo
   *
   * Original thrift constant:-
   * string FOO
   */
  const string FOO = "foo";

  /**
   * Multi-
   * line
   * slash comment
   *
   * Original thrift constant:-
   * i32 BAR
   */
  const int BAR = 123;

  /**
   * BIFF has your mail
   *
   * Original thrift constant:-
   * i32 BIFF
   */
  const int BIFF = 0;

  /**
   * Original thrift constant:-
   * i32 SHOUTY
   */
  const int SHOUTY = 11;

  public static function getAllStructuredAnnotations()[write_props]: dict<string, dict<string, \IThriftStruct>> {
    return dict[
    ];
  }
}


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

/**
 * This enum is great
 *
 * Original thrift enum:-
 * B
 */
enum B: int {
  /**
   * EnumDef doctext.
   */
  HELLO = 0;
}

class B_TEnumStaticMetadata implements \IThriftEnumStaticMetadata {
  public static function getEnumMetadata()[]: \tmeta_ThriftEnum {
    return tmeta_ThriftEnum::fromShape(
      shape(
        "name" => "module.B",
        "elements" => dict[
          0 => "HELLO",
        ],
      )
    );
  }

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

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

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

  const type TConstructorShape = shape(
    ?'useless_field' => ?int,
  );

  const int STRUCTURAL_ID = 4169556808001627706;
  /**
   * Field doctext.
   *
   * Original thrift field:-
   * 1: i32 useless_field
   */
  public int $useless_field;

  public function __construct(?int $useless_field = null)[] {
    $this->useless_field = $useless_field ?? 0;
  }

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

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

  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_I32_TYPE,
                )
              ),
              "name" => "useless_field",
            )
          ),
        ],
        "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);
  }

}

enum UEnum: int {
  _EMPTY_ = 0;
  i = 1;
  s = 2;
}

/**
 * Union U
 *
 * Original thrift struct:-
 * U
 */
class U implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftUnion<UEnum> {
  use \ThriftUnionSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'i',
      'union' => true,
      'type' => \TType::I32,
    ),
    2 => shape(
      'var' => 's',
      'union' => true,
      'type' => \TType::STRING,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'i' => 1,
    's' => 2,
  ];

  const type TConstructorShape = shape(
    ?'i' => ?int,
    ?'s' => ?string,
  );

  const int STRUCTURAL_ID = 3963907419268179345;
  /**
   * i32 field i
   *
   * Original thrift field:-
   * 1: i32 i
   */
  public ?int $i;
  /**
   * string s
   *
   * Original thrift field:-
   * 2: string s
   */
  public ?string $s;
  protected UEnum $_type = UEnum::_EMPTY_;

  public function __construct(?int $i = null, ?string $s = null)[] {
    $this->_type = UEnum::_EMPTY_;
    if ($i !== null) {
      $this->i = $i;
      $this->_type = UEnum::i;
    }
    if ($s !== null) {
      $this->s = $s;
      $this->_type = UEnum::s;
    }
  }

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

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

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

  public function getType()[]: UEnum {
    return $this->_type;
  }

  public function reset()[write_props]: void {
    switch ($this->_type) {
      case UEnum::i:
        $this->i = null;
        break;
      case UEnum::s:
        $this->s = null;
        break;
      case UEnum::_EMPTY_:
        break;
    }
    $this->_type = UEnum::_EMPTY_;
  }

  public function set_i(int $i)[write_props]: this {
    $this->reset();
    $this->_type = UEnum::i;
    $this->i = $i;
    return $this;
  }

  public function get_i()[]: ?int {
    return $this->i;
  }

  public function getx_i()[]: int {
    invariant(
      $this->_type === UEnum::i,
      'get_i called on an instance of U whose current type is %s',
      (string)$this->_type,
    );
    return $this->i as nonnull;
  }

  public function set_s(string $s)[write_props]: this {
    $this->reset();
    $this->_type = UEnum::s;
    $this->s = $s;
    return $this;
  }

  public function get_s()[]: ?string {
    return $this->s;
  }

  public function getx_s()[]: string {
    invariant(
      $this->_type === UEnum::s,
      'get_s called on an instance of U whose current type is %s',
      (string)$this->_type,
    );
    return $this->s as nonnull;
  }

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.U",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "i",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "s",
            )
          ),
        ],
        "is_union" => true,
      )
    );
  }

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

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

}

/**
 * Something amiss
 *
 * Original thrift exception:-
 * Bang
 */
class Bang extends \TException implements \IThriftSyncStruct, \IThriftExceptionMetadata {
  use \ThriftSerializationTrait;

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

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

  const int STRUCTURAL_ID = 2427562471238739676;
  /**
   * All explosions can be explained away
   *
   * Original thrift field:-
   * 1: string message
   */
  public string $message;

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

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

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

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

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

  public static function getExceptionMetadata()[]: \tmeta_ThriftException {
    return tmeta_ThriftException::fromShape(
      shape(
        "name" => "module.Bang",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
                )
              ),
              "name" => "message",
            )
          ),
        ],
      )
    );
  }

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

  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
 */

namespace test\fixtures\enums;

/**
 * Original thrift enum:-
 * Metasyntactic
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/enums/Metasyntactic'))>>
enum Metasyntactic: int {
  FOO = 1;
  BAR = 2;
  BAZ = 3;
  BAX = 4;
}

class Metasyntactic_TEnumStaticMetadata implements \IThriftEnumStaticMetadata {
  public static function getEnumMetadata()[]: \tmeta_ThriftEnum {
    return \tmeta_ThriftEnum::fromShape(
      shape(
        "name" => "module.Metasyntactic",
        "elements" => dict[
          1 => "FOO",
          2 => "BAR",
          3 => "BAZ",
          4 => "BAX",
        ],
      )
    );
  }

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

/**
 * Original thrift enum:-
 * MyEnum1
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/enums/MyEnum1'))>>
enum MyEnum1: int {
  ME1_0 = 0;
  ME1_1 = 1;
  ME1_2 = 2;
  ME1_3 = 3;
  ME1_5 = 5;
  ME1_6 = 6;
}

class MyEnum1_TEnumStaticMetadata implements \IThriftEnumStaticMetadata {
  public static function getEnumMetadata()[]: \tmeta_ThriftEnum {
    return \tmeta_ThriftEnum::fromShape(
      shape(
        "name" => "module.MyEnum1",
        "elements" => dict[
          0 => "ME1_0",
          1 => "ME1_1",
          2 => "ME1_2",
          3 => "ME1_3",
          5 => "ME1_5",
          6 => "ME1_6",
        ],
      )
    );
  }

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

/**
 * Original thrift enum:-
 * MyEnum2
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/enums/MyEnum2'))>>
enum MyEnum2: int {
  ME2_0 = 0;
  ME2_1 = 1;
  ME2_2 = 2;
}

class MyEnum2_TEnumStaticMetadata implements \IThriftEnumStaticMetadata {
  public static function getEnumMetadata()[]: \tmeta_ThriftEnum {
    return \tmeta_ThriftEnum::fromShape(
      shape(
        "name" => "module.MyEnum2",
        "elements" => dict[
          0 => "ME2_0",
          1 => "ME2_1",
          2 => "ME2_2",
        ],
      )
    );
  }

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

/**
 * Original thrift enum:-
 * MyEnum3
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/enums/MyEnum3'))>>
enum MyEnum3: int {
  ME3_0 = 0;
  ME3_1 = 1;
  ME3_N2 = -2;
  ME3_N1 = -1;
  ME3_9 = 9;
  ME3_10 = 10;
}

class MyEnum3_TEnumStaticMetadata implements \IThriftEnumStaticMetadata {
  public static function getEnumMetadata()[]: \tmeta_ThriftEnum {
    return \tmeta_ThriftEnum::fromShape(
      shape(
        "name" => "module.MyEnum3",
        "elements" => dict[
          0 => "ME3_0",
          1 => "ME3_1",
          -2 => "ME3_N2",
          -1 => "ME3_N1",
          9 => "ME3_9",
          10 => "ME3_10",
        ],
      )
    );
  }

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

/**
 * Original thrift enum:-
 * MyEnum4
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/enums/MyEnum4'))>>
enum MyEnum4: int {
  ME4_A = 2147483645;
  ME4_B = 2147483646;
  ME4_C = 2147483647;
  ME4_D = -2147483648;
}

class MyEnum4_TEnumStaticMetadata implements \IThriftEnumStaticMetadata {
  public static function getEnumMetadata()[]: \tmeta_ThriftEnum {
    return \tmeta_ThriftEnum::fromShape(
      shape(
        "name" => "module.MyEnum4",
        "elements" => dict[
          2147483645 => "ME4_A",
          2147483646 => "ME4_B",
          2147483647 => "ME4_C",
          -2147483648 => "ME4_D",
        ],
      )
    );
  }

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

/**
 * Original thrift enum:-
 * MyBitmaskEnum1
 */
final class MyBitmaskEnum1 extends \Flags {
  const int   ONE = 1;
  const int   TWO = 2;
  const int   FOUR = 4;
}

class MyBitmaskEnum1_TEnumStaticMetadata implements \IThriftEnumStaticMetadata {
  public static function getEnumMetadata()[]: \tmeta_ThriftEnum {
    return \tmeta_ThriftEnum::fromShape(
      shape(
        "name" => "module.MyBitmaskEnum1",
        "elements" => dict[
          1 => "ONE",
          2 => "TWO",
          4 => "FOUR",
        ],
      )
    );
  }

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

/**
 * Original thrift enum:-
 * MyBitmaskEnum2
 */
final class MyBitmaskEnum2 extends \Flags {
  const int   ONE = 1;
  const int   TWO = 2;
  const int   FOUR = 4;
}

class MyBitmaskEnum2_TEnumStaticMetadata implements \IThriftEnumStaticMetadata {
  public static function getEnumMetadata()[]: \tmeta_ThriftEnum {
    return \tmeta_ThriftEnum::fromShape(
      shape(
        "name" => "module.MyBitmaskEnum2",
        "elements" => dict[
          1 => "ONE",
          2 => "TWO",
          4 => "FOUR",
        ],
      )
    );
  }

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

/**
 * Original thrift struct:-
 * SomeStruct
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/enums/SomeStruct'))>>
class SomeStruct implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'reasonable',
      'type' => \TType::I32,
      'enum' => \test\fixtures\enums\Metasyntactic::class,
    ),
    2 => shape(
      'var' => 'fine',
      'type' => \TType::I32,
      'enum' => \test\fixtures\enums\Metasyntactic::class,
    ),
    3 => shape(
      'var' => 'questionable',
      'type' => \TType::I32,
      'enum' => \test\fixtures\enums\Metasyntactic::class,
    ),
    4 => shape(
      'var' => 'tags',
      'type' => \TType::SET,
      'etype' => \TType::I32,
      'elem' => shape(
        'type' => \TType::I32,
      ),
      'format' => 'collection',
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'reasonable' => 1,
    'fine' => 2,
    'questionable' => 3,
    'tags' => 4,
  ];

  const type TConstructorShape = shape(
    ?'reasonable' => ?\test\fixtures\enums\Metasyntactic,
    ?'fine' => ?\test\fixtures\enums\Metasyntactic,
    ?'questionable' => ?\test\fixtures\enums\Metasyntactic,
    ?'tags' => ?Set<int>,
  );

  const type TShape = shape(
    ?'reasonable' => ?\test\fixtures\enums\Metasyntactic,
    ?'fine' => ?\test\fixtures\enums\Metasyntactic,
    ?'questionable' => ?\test\fixtures\enums\Metasyntactic,
    'tags' => dict<int, bool>,
    ...
  );
  const int STRUCTURAL_ID = 8159017183734005742;
  /**
   * Original thrift field:-
   * 1: module.Metasyntactic reasonable
   */
  public ?\test\fixtures\enums\Metasyntactic $reasonable;
  /**
   * Original thrift field:-
   * 2: module.Metasyntactic fine
   */
  public ?\test\fixtures\enums\Metasyntactic $fine;
  /**
   * Original thrift field:-
   * 3: module.Metasyntactic questionable
   */
  public ?\test\fixtures\enums\Metasyntactic $questionable;
  /**
   * Original thrift field:-
   * 4: set<i32> tags
   */
  public Set<int> $tags;

  public function __construct(?\test\fixtures\enums\Metasyntactic $reasonable = null, ?\test\fixtures\enums\Metasyntactic $fine = null, ?\test\fixtures\enums\Metasyntactic $questionable = null, ?Set<int> $tags = null)[] {
    $this->reasonable = $reasonable ?? \test\fixtures\enums\Metasyntactic::FOO;
    $this->fine = $fine ?? \test\fixtures\enums\Metasyntactic::BAR;
    $this->questionable = $questionable ?? \test\fixtures\enums\Metasyntactic::coerce(-1);
    $this->tags = $tags ?? Set {
    };
  }

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

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

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.SomeStruct",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => \tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.Metasyntactic",
                    )
                  ),
                )
              ),
              "name" => "reasonable",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => \tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.Metasyntactic",
                    )
                  ),
                )
              ),
              "name" => "fine",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 3,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => \tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.Metasyntactic",
                    )
                  ),
                )
              ),
              "name" => "questionable",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 4,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_set" => \tmeta_ThriftSetType::fromShape(
                    shape(
                      "valueType" => \tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "name" => "tags",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

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

  public static function __fromShape(self::TShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'reasonable'),
      Shapes::idx($shape, 'fine'),
      Shapes::idx($shape, 'questionable'),
      new Set(Keyset\keys($shape['tags'])),
    );
  }

  public function __toShape()[]: self::TShape {
    return shape(
      'reasonable' => $this->reasonable,
      'fine' => $this->fine,
      'questionable' => $this->questionable,
      'tags' => ThriftUtil::toDArray(Dict\fill_keys($this->tags->toValuesArray(), true), static::class),
    );
  }
  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'reasonable') !== null) {
      $this->reasonable = \test\fixtures\enums\Metasyntactic::coerce(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\enums\Metasyntactic>($parsed['reasonable']));
    }
    if (idx($parsed, 'fine') !== null) {
      $this->fine = \test\fixtures\enums\Metasyntactic::coerce(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\enums\Metasyntactic>($parsed['fine']));
    }
    if (idx($parsed, 'questionable') !== null) {
      $this->questionable = \test\fixtures\enums\Metasyntactic::coerce(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\enums\Metasyntactic>($parsed['questionable']));
    }
    if (idx($parsed, 'tags') !== null) {
      $_json3 = HH\FIXME\UNSAFE_CAST<mixed, Set<int>>($parsed['tags']);
      $_container4 = Set {};
      foreach($_json3 as $_key1 => $_value2) {
        $_elem5 = 0;
        $_tmp6 = (int)$_value2;
        if ($_tmp6 > 0x7fffffff) {
          throw new \TProtocolException("number exceeds limit in field");
        } else {
          $_elem5 = (int)$_tmp6;
        }
        $_container4->add($_elem5);
      }
      $this->tags = $_container4;
    }
  }

}

/**
 * Original thrift struct:-
 * MyStruct
 */
<<\ThriftTypeInfo(shape('uri' => 'test.dev/fixtures/enums/MyStruct'))>>
class MyStruct implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'me2_3',
      'type' => \TType::I32,
      'enum' => \test\fixtures\enums\MyEnum2::class,
    ),
    2 => shape(
      'var' => 'me3_n3',
      'type' => \TType::I32,
      'enum' => \test\fixtures\enums\MyEnum3::class,
    ),
    4 => shape(
      'var' => 'me1_t1',
      'type' => \TType::I32,
      'enum' => \test\fixtures\enums\MyEnum1::class,
    ),
    6 => shape(
      'var' => 'me1_t2',
      'type' => \TType::I32,
      'enum' => \test\fixtures\enums\MyEnum1::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'me2_3' => 1,
    'me3_n3' => 2,
    'me1_t1' => 4,
    'me1_t2' => 6,
  ];

  const type TConstructorShape = shape(
    ?'me2_3' => ?\test\fixtures\enums\MyEnum2,
    ?'me3_n3' => ?\test\fixtures\enums\MyEnum3,
    ?'me1_t1' => ?\test\fixtures\enums\MyEnum1,
    ?'me1_t2' => ?\test\fixtures\enums\MyEnum1,
  );

  const type TShape = shape(
    ?'me2_3' => ?\test\fixtures\enums\MyEnum2,
    ?'me3_n3' => ?\test\fixtures\enums\MyEnum3,
    ?'me1_t1' => ?\test\fixtures\enums\MyEnum1,
    ?'me1_t2' => ?\test\fixtures\enums\MyEnum1,
    ...
  );
  const int STRUCTURAL_ID = 8234221749727407461;
  /**
   * Original thrift field:-
   * 1: module.MyEnum2 me2_3
   */
  public ?\test\fixtures\enums\MyEnum2 $me2_3;
  /**
   * Original thrift field:-
   * 2: module.MyEnum3 me3_n3
   */
  public ?\test\fixtures\enums\MyEnum3 $me3_n3;
  /**
   * Original thrift field:-
   * 4: module.MyEnum1 me1_t1
   */
  public ?\test\fixtures\enums\MyEnum1 $me1_t1;
  /**
   * Original thrift field:-
   * 6: module.MyEnum1 me1_t2
   */
  public ?\test\fixtures\enums\MyEnum1 $me1_t2;

  public function __construct(?\test\fixtures\enums\MyEnum2 $me2_3 = null, ?\test\fixtures\enums\MyEnum3 $me3_n3 = null, ?\test\fixtures\enums\MyEnum1 $me1_t1 = null, ?\test\fixtures\enums\MyEnum1 $me1_t2 = null)[] {
    $this->me2_3 = $me2_3 ?? \test\fixtures\enums\MyEnum2::coerce(3);
    $this->me3_n3 = $me3_n3 ?? \test\fixtures\enums\MyEnum3::coerce(-3);
    $this->me1_t1 = $me1_t1 ?? \test\fixtures\enums\MyEnum1::ME1_1;
    $this->me1_t2 = $me1_t2 ?? \test\fixtures\enums\MyEnum1::ME1_1;
  }

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

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

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.MyStruct",
        "fields" => vec[
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => \tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.MyEnum2",
                    )
                  ),
                )
              ),
              "name" => "me2_3",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => \tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.MyEnum3",
                    )
                  ),
                )
              ),
              "name" => "me3_n3",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 4,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => \tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.MyEnum1",
                    )
                  ),
                )
              ),
              "name" => "me1_t1",
            )
          ),
          \tmeta_ThriftField::fromShape(
            shape(
              "id" => 6,
              "type" => \tmeta_ThriftType::fromShape(
                shape(
                  "t_enum" => \tmeta_ThriftEnumType::fromShape(
                    shape(
                      "name" => "module.MyEnum1",
                    )
                  ),
                )
              ),
              "name" => "me1_t2",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

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

  public static function __fromShape(self::TShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'me2_3'),
      Shapes::idx($shape, 'me3_n3'),
      Shapes::idx($shape, 'me1_t1'),
      Shapes::idx($shape, 'me1_t2'),
    );
  }

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

    if (idx($parsed, 'me2_3') !== null) {
      $this->me2_3 = \test\fixtures\enums\MyEnum2::coerce(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\enums\MyEnum2>($parsed['me2_3']));
    }
    if (idx($parsed, 'me3_n3') !== null) {
      $this->me3_n3 = \test\fixtures\enums\MyEnum3::coerce(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\enums\MyEnum3>($parsed['me3_n3']));
    }
    if (idx($parsed, 'me1_t1') !== null) {
      $this->me1_t1 = \test\fixtures\enums\MyEnum1::coerce(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\enums\MyEnum1>($parsed['me1_t1']));
    }
    if (idx($parsed, 'me1_t2') !== null) {
      $this->me1_t2 = \test\fixtures\enums\MyEnum1::coerce(HH\FIXME\UNSAFE_CAST<mixed, \test\fixtures\enums\MyEnum1>($parsed['me1_t2']));
    }
  }

}


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

namespace facebook\thrift\annotation;

/**
 * Indicates that the scope of sibling annotations is transitive.
 *
 * For example:
 *
 *     @scope.Struct
 *     @scope.Union
 *     @scope.Exception
 *     @scope.Transitive
 *     struct Structured {}
 *
 * Annotating a Thrift struct with @Structured automatically applies
 * @scope.Struct, @scope.Union and @scope.Exception annotations, i.e.
 *
 *     @Structured
 *     struct MyAnnotation {}
 *
 * is equivalent to
 *
 *     @scope.Struct
 *     @scope.Union
 *     @scope.Exception
 *     struct MyAnnotation {}
 *
 *
 * Original thrift struct:-
 * Transitive
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Transitive'))>>
class Transitive implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Transitive",
        "is_union" => false,
      )
    );
  }

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

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * Indicates that an annotation should be included in the runtime schema.
 *
 * See thrift/lib/thrift/schema.thrift
 *
 * Original thrift struct:-
 * Schema
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Schema'))>>
class Schema implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Schema",
        "is_union" => false,
      )
    );
  }

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

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * The Program scope.
 *
 * This allows annotations on the `package` definition, which implies the
 * annotaiton applies to the entire program.
 *
 * Original thrift struct:-
 * Program
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Program'))>>
class Program implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Program",
        "is_union" => false,
      )
    );
  }

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

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * The `struct` definition scope.
 *
 * Original thrift struct:-
 * Struct
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Struct'))>>
class Struct implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Struct",
        "is_union" => false,
      )
    );
  }

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

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * The `union` definition scope.
 *
 * Original thrift struct:-
 * Union
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Union'))>>
class Union implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Union",
        "is_union" => false,
      )
    );
  }

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

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * The `exception` definition scope.
 *
 * Original thrift struct:-
 * Exception
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Exception'))>>
class Exception implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Exception",
        "is_union" => false,
      )
    );
  }

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

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * Field declartaions, for example in `struct` or `function` declartions.
 *
 * Original thrift struct:-
 * Field
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Field'))>>
class Field implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Field",
        "is_union" => false,
      )
    );
  }

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

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * The `typedef` definition scope.
 *
 * Original thrift struct:-
 * Typedef
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Typedef'))>>
class Typedef implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Typedef",
        "is_union" => false,
      )
    );
  }

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

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * The `service` definition scope.
 *
 * Original thrift struct:-
 * Service
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Service'))>>
class Service implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Service",
        "is_union" => false,
      )
    );
  }

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

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * The `interaction` definition scope.
 *
 * Original thrift struct:-
 * Interaction
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Interaction'))>>
class Interaction implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Interaction",
        "is_union" => false,
      )
    );
  }

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

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * The `function` definition scope.
 *
 * Original thrift struct:-
 * Function
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Function'))>>
class TFunction implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Function",
        "is_union" => false,
      )
    );
  }

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

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * The Enum value definition scope.
 *
 * Original thrift struct:-
 * EnumValue
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/EnumValue'))>>
class EnumValue implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.EnumValue",
        "is_union" => false,
      )
    );
  }

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

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * The `const` definition scope.
 *
 * Original thrift struct:-
 * Const
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Const'))>>
class TConst implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Const",
        "is_union" => false,
      )
    );
  }

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

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * Original thrift struct:-
 * Enum
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Enum'))>>
class Enum implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Enum",
        "is_union" => false,
      )
    );
  }

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

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * A scope that includes all 'structured' definitions.
 *
 * Original thrift struct:-
 * Structured
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Structured'))>>
class Structured implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Structured",
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\Struct' => \facebook\thrift\annotation\Struct::fromShape(
          shape(
          )
        ),
        '\facebook\thrift\annotation\Union' => \facebook\thrift\annotation\Union::fromShape(
          shape(
          )
        ),
        '\facebook\thrift\annotation\Exception' => \facebook\thrift\annotation\Exception::fromShape(
          shape(
          )
        ),
        '\facebook\thrift\annotation\Transitive' => \facebook\thrift\annotation\Transitive::fromShape(
          shape(
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * A scope that includes all 'interface' definitions.
 *
 * Original thrift struct:-
 * Interface
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Interface'))>>
class TInterface implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Interface",
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\Service' => \facebook\thrift\annotation\Service::fromShape(
          shape(
          )
        ),
        '\facebook\thrift\annotation\Interaction' => \facebook\thrift\annotation\Interaction::fromShape(
          shape(
          )
        ),
        '\facebook\thrift\annotation\Transitive' => \facebook\thrift\annotation\Transitive::fromShape(
          shape(
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * A scope that includes all program-scoped definition.
 *
 * Original thrift struct:-
 * RootDefinition
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/RootDefinition'))>>
class RootDefinition implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.RootDefinition",
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\Structured' => \facebook\thrift\annotation\Structured::fromShape(
          shape(
          )
        ),
        '\facebook\thrift\annotation\TInterface' => \facebook\thrift\annotation\TInterface::fromShape(
          shape(
          )
        ),
        '\facebook\thrift\annotation\Typedef' => \facebook\thrift\annotation\Typedef::fromShape(
          shape(
          )
        ),
        '\facebook\thrift\annotation\Enum' => \facebook\thrift\annotation\Enum::fromShape(
          shape(
          )
        ),
        '\facebook\thrift\annotation\TConst' => \facebook\thrift\annotation\TConst::fromShape(
          shape(
          )
        ),
        '\facebook\thrift\annotation\Transitive' => \facebook\thrift\annotation\Transitive::fromShape(
          shape(
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}

/**
 * A scope that includes all definitions.
 *
 * Original thrift struct:-
 * Definition
 */
<<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/Definition'))>>
class Definition implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapishSyncStruct {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const type TShape = shape(
    ...
  );
  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

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

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

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

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

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return \tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "scope.Definition",
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[
        '\facebook\thrift\annotation\RootDefinition' => \facebook\thrift\annotation\RootDefinition::fromShape(
          shape(
          )
        ),
        '\facebook\thrift\annotation\Field' => \facebook\thrift\annotation\Field::fromShape(
          shape(
          )
        ),
        '\facebook\thrift\annotation\TFunction' => \facebook\thrift\annotation\TFunction::fromShape(
          shape(
          )
        ),
        '\facebook\thrift\annotation\EnumValue' => \facebook\thrift\annotation\EnumValue::fromShape(
          shape(
          )
        ),
        '\facebook\thrift\annotation\Transitive' => \facebook\thrift\annotation\Transitive::fromShape(
          shape(
          )
        ),
      ],
      'fields' => dict[
      ],
    );
  }

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

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

  public function readFromJson(string $jsonText): void {
    $parsed = json_decode($jsonText, true);

    if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
      throw new \TProtocolException("Cannot parse the given json string.");
    }

  }

}