1<?hh // strict
2/**
3 * Autogenerated by Thrift
4 *
5 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
6 *  @generated
7 */
8
9/**
10 * Original thrift struct:-
11 * Foo
12 */
13class Foo implements \IThriftStruct, \IThriftShapishStruct {
14  use \ThriftSerializationTrait;
15
16  const dict<int, this::TFieldSpec> SPEC = dict[
17    1 => shape(
18      'var' => 'a',
19      'type' => \TType::LST,
20      'etype' => \TType::STRING,
21      'elem' => shape(
22        'type' => \TType::STRING,
23      ),
24      'format' => 'array',
25    ),
26    2 => shape(
27      'var' => 'b',
28      'type' => \TType::MAP,
29      'ktype' => \TType::STRING,
30      'vtype' => \TType::LST,
31      'key' => shape(
32        'type' => \TType::STRING,
33      ),
34      'val' => shape(
35        'type' => \TType::LST,
36        'etype' => \TType::SET,
37        'elem' => shape(
38          'type' => \TType::SET,
39          'etype' => \TType::I32,
40          'elem' => shape(
41            'type' => \TType::I32,
42          ),
43          'format' => 'array',
44        ),
45        'format' => 'array',
46      ),
47      'format' => 'array',
48    ),
49    3 => shape(
50      'var' => 'c',
51      'type' => \TType::I64,
52    ),
53    4 => shape(
54      'var' => 'd',
55      'type' => \TType::BOOL,
56    ),
57  ];
58  const dict<string, int> FIELDMAP = dict[
59    'a' => 1,
60    'b' => 2,
61    'c' => 3,
62    'd' => 4,
63  ];
64
65  const type TConstructorShape = shape(
66    ?'a' => ?varray<string>,
67    ?'b' => ?darray<string, varray<darray<int, bool>>>,
68    ?'c' => ?int,
69    ?'d' => ?bool,
70  );
71
72  const type TShape = shape(
73    'a' => varray<string>,
74    ?'b' => ?darray<string, varray<darray<int, bool>>>,
75    'c' => int,
76    ?'d' => ?bool,
77  );
78  const int STRUCTURAL_ID = 3946809642153193229;
79  /**
80   * Original thrift field:-
81   * 1: list<string> a
82   */
83  public varray<string> $a;
84  /**
85   * Original thrift field:-
86   * 2: map<string, list<set<i32>>> b
87   */
88  public ?darray<string, varray<darray<int, bool>>> $b;
89  /**
90   * Original thrift field:-
91   * 3: i64 c
92   */
93  public int $c;
94  /**
95   * Original thrift field:-
96   * 4: bool d
97   */
98  public ?bool $d;
99
100  <<__ProvenanceSkipFrame>>
101  public function __construct(?varray<string> $a = null, ?darray<string, varray<darray<int, bool>>> $b = null, ?int $c = null, ?bool $d = null  )[] {
102    $this->a = $a ?? varray[];
103    $this->b = $b;
104    $this->c = $c ?? 7;
105    $this->d = $d;
106  }
107
108  <<__ProvenanceSkipFrame>>
109  public static function withDefaultValues()[]: this {
110    return new static();
111  }
112
113  <<__ProvenanceSkipFrame>>
114  public static function fromShape(self::TConstructorShape $shape)[]: this {
115    return new static(
116      Shapes::idx($shape, 'a'),
117      Shapes::idx($shape, 'b'),
118      Shapes::idx($shape, 'c'),
119      Shapes::idx($shape, 'd'),
120    );
121  }
122
123  public function getName()[]: string {
124    return 'Foo';
125  }
126
127  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
128    return tmeta_ThriftStruct::fromShape(
129      shape(
130        "name" => "module.Foo",
131        "fields" => vec[
132          tmeta_ThriftField::fromShape(
133            shape(
134              "id" => 1,
135              "type" => tmeta_ThriftType::fromShape(
136                shape(
137                  "t_list" => tmeta_ThriftListType::fromShape(
138                    shape(
139                      "valueType" => tmeta_ThriftType::fromShape(
140                        shape(
141                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
142                        )
143                      ),
144                    )
145                  ),
146                )
147              ),
148              "name" => "a",
149            )
150          ),
151          tmeta_ThriftField::fromShape(
152            shape(
153              "id" => 2,
154              "type" => tmeta_ThriftType::fromShape(
155                shape(
156                  "t_map" => tmeta_ThriftMapType::fromShape(
157                    shape(
158                      "keyType" => tmeta_ThriftType::fromShape(
159                        shape(
160                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
161                        )
162                      ),
163                      "valueType" => tmeta_ThriftType::fromShape(
164                        shape(
165                          "t_list" => tmeta_ThriftListType::fromShape(
166                            shape(
167                              "valueType" => tmeta_ThriftType::fromShape(
168                                shape(
169                                  "t_set" => tmeta_ThriftSetType::fromShape(
170                                    shape(
171                                      "valueType" => tmeta_ThriftType::fromShape(
172                                        shape(
173                                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
174                                        )
175                                      ),
176                                    )
177                                  ),
178                                )
179                              ),
180                            )
181                          ),
182                        )
183                      ),
184                    )
185                  ),
186                )
187              ),
188              "name" => "b",
189              "is_optional" => true,
190            )
191          ),
192          tmeta_ThriftField::fromShape(
193            shape(
194              "id" => 3,
195              "type" => tmeta_ThriftType::fromShape(
196                shape(
197                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE,
198                )
199              ),
200              "name" => "c",
201            )
202          ),
203          tmeta_ThriftField::fromShape(
204            shape(
205              "id" => 4,
206              "type" => tmeta_ThriftType::fromShape(
207                shape(
208                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE,
209                )
210              ),
211              "name" => "d",
212              "is_optional" => true,
213            )
214          ),
215        ],
216        "is_union" => false,
217      )
218    );
219  }
220
221  public static function getAllStructuredAnnotations()[]: \TStructAnnotations {
222    return shape(
223      'struct' => dict[],
224      'fields' => dict[
225      ],
226    );
227  }
228
229  <<__ProvenanceSkipFrame>>
230  public static function __fromShape(self::TShape $shape)[]: this {
231    return new static(
232      $shape['a'],
233      Shapes::idx($shape, 'b'),
234      $shape['c'],
235      Shapes::idx($shape, 'd'),
236    );
237  }
238
239  <<__ProvenanceSkipFrame>>
240  public function __toShape()[]: self::TShape {
241    return shape(
242      'a' => $this->a,
243      'b' => $this->b,
244      'c' => $this->c,
245      'd' => $this->d,
246    );
247  }
248}
249
250/**
251 * Original thrift exception:-
252 * Baz
253 */
254class Baz extends \TException implements \IThriftStruct {
255  use \ThriftSerializationTrait;
256
257  const dict<int, this::TFieldSpec> SPEC = dict[
258    1 => shape(
259      'var' => 'message',
260      'type' => \TType::STRING,
261    ),
262    2 => shape(
263      'var' => 'some_field',
264      'type' => \TType::STRUCT,
265      'class' => Foo::class,
266    ),
267    3 => shape(
268      'var' => 'some_container',
269      'type' => \TType::SET,
270      'etype' => \TType::STRING,
271      'elem' => shape(
272        'type' => \TType::STRING,
273      ),
274      'format' => 'array',
275    ),
276    4 => shape(
277      'var' => 'code',
278      'type' => \TType::I32,
279    ),
280  ];
281  const dict<string, int> FIELDMAP = dict[
282    'message' => 1,
283    'some_field' => 2,
284    'some_container' => 3,
285    'code' => 4,
286  ];
287
288  const type TConstructorShape = shape(
289    ?'message' => ?string,
290    ?'some_field' => ?Foo,
291    ?'some_container' => ?darray<string, bool>,
292    ?'code' => ?int,
293  );
294
295  const int STRUCTURAL_ID = 1663976252517274137;
296  /**
297   * Original thrift field:-
298   * 1: string message
299   */
300  public string $message;
301  /**
302   * Original thrift field:-
303   * 2: struct module.Foo some_field
304   */
305  public ?Foo $some_field;
306  /**
307   * Original thrift field:-
308   * 3: set<string> some_container
309   */
310  public darray<string, bool> $some_container;
311  /**
312   * Original thrift field:-
313   * 4: i32 code
314   */
315  public int $code;
316
317  <<__ProvenanceSkipFrame>>
318  public function __construct(?string $message = null, ?Foo $some_field = null, ?darray<string, bool> $some_container = null, ?int $code = null  )[] {
319    parent::__construct();
320    $this->message = $message ?? '';
321    $this->some_field = $some_field;
322    $this->some_container = $some_container ?? darray[];
323    $this->code = $code ?? 0;
324  }
325
326  <<__ProvenanceSkipFrame>>
327  public static function withDefaultValues()[]: this {
328    return new static();
329  }
330
331  <<__ProvenanceSkipFrame>>
332  public static function fromShape(self::TConstructorShape $shape)[]: this {
333    return new static(
334      Shapes::idx($shape, 'message'),
335      Shapes::idx($shape, 'some_field'),
336      Shapes::idx($shape, 'some_container'),
337      Shapes::idx($shape, 'code'),
338    );
339  }
340
341  public function getName()[]: string {
342    return 'Baz';
343  }
344
345  public static function getExceptionMetadata()[]: \tmeta_ThriftException {
346    return tmeta_ThriftException::fromShape(
347      shape(
348        "name" => "module.Baz",
349        "fields" => vec[
350          tmeta_ThriftField::fromShape(
351            shape(
352              "id" => 1,
353              "type" => tmeta_ThriftType::fromShape(
354                shape(
355                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
356                )
357              ),
358              "name" => "message",
359            )
360          ),
361          tmeta_ThriftField::fromShape(
362            shape(
363              "id" => 2,
364              "type" => tmeta_ThriftType::fromShape(
365                shape(
366                  "t_struct" => tmeta_ThriftStructType::fromShape(
367                    shape(
368                      "name" => "module.Foo",
369                    )
370                  ),
371                )
372              ),
373              "name" => "some_field",
374            )
375          ),
376          tmeta_ThriftField::fromShape(
377            shape(
378              "id" => 3,
379              "type" => tmeta_ThriftType::fromShape(
380                shape(
381                  "t_set" => tmeta_ThriftSetType::fromShape(
382                    shape(
383                      "valueType" => tmeta_ThriftType::fromShape(
384                        shape(
385                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
386                        )
387                      ),
388                    )
389                  ),
390                )
391              ),
392              "name" => "some_container",
393            )
394          ),
395          tmeta_ThriftField::fromShape(
396            shape(
397              "id" => 4,
398              "type" => tmeta_ThriftType::fromShape(
399                shape(
400                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
401                )
402              ),
403              "name" => "code",
404            )
405          ),
406        ],
407      )
408    );
409  }
410
411  public static function getAllStructuredAnnotations()[]: \TStructAnnotations {
412    return shape(
413      'struct' => dict[],
414      'fields' => dict[
415      ],
416    );
417  }
418
419}
420
421/**
422 * Original thrift exception:-
423 * OptBaz
424 */
425class OptBaz extends \TException implements \IThriftStruct {
426  use \ThriftSerializationTrait;
427
428  const dict<int, this::TFieldSpec> SPEC = dict[
429    1 => shape(
430      'var' => 'message',
431      'type' => \TType::STRING,
432    ),
433  ];
434  const dict<string, int> FIELDMAP = dict[
435    'message' => 1,
436  ];
437
438  const type TConstructorShape = shape(
439    ?'message' => ?string,
440  );
441
442  const int STRUCTURAL_ID = 546500496397478593;
443  /**
444   * Original thrift field:-
445   * 1: string message
446   */
447  public string $message;
448
449  <<__ProvenanceSkipFrame>>
450  public function __construct(?string $message = null  )[] {
451    parent::__construct();
452    $this->message = $message ?? '';
453  }
454
455  <<__ProvenanceSkipFrame>>
456  public static function withDefaultValues()[]: this {
457    return new static();
458  }
459
460  <<__ProvenanceSkipFrame>>
461  public static function fromShape(self::TConstructorShape $shape)[]: this {
462    return new static(
463      Shapes::idx($shape, 'message'),
464    );
465  }
466
467  public function getName()[]: string {
468    return 'OptBaz';
469  }
470
471  public static function getExceptionMetadata()[]: \tmeta_ThriftException {
472    return tmeta_ThriftException::fromShape(
473      shape(
474        "name" => "module.OptBaz",
475        "fields" => vec[
476          tmeta_ThriftField::fromShape(
477            shape(
478              "id" => 1,
479              "type" => tmeta_ThriftType::fromShape(
480                shape(
481                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
482                )
483              ),
484              "name" => "message",
485              "is_optional" => true,
486            )
487          ),
488        ],
489      )
490    );
491  }
492
493  public static function getAllStructuredAnnotations()[]: \TStructAnnotations {
494    return shape(
495      'struct' => dict[],
496      'fields' => dict[
497      ],
498    );
499  }
500
501}
502
503