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 enum:- 11 * Animal 12 */ 13enum Animal: int { 14 DOG = 1; 15 CAT = 2; 16 TARANTULA = 3; 17} 18 19class Animal_TEnumStaticMetadata implements \IThriftEnumStaticMetadata { 20 public static function getEnumMetadata()[]: \tmeta_ThriftEnum { 21 return tmeta_ThriftEnum::fromShape( 22 shape( 23 "name" => "module.Animal", 24 "elements" => dict[ 25 1 => "DOG", 26 2 => "CAT", 27 3 => "TARANTULA", 28 ], 29 ) 30 ); 31 } 32 33 public static function getAllStructuredAnnotations()[]: \TEnumAnnotations { 34 return shape( 35 'enum' => dict[], 36 'constants' => dict[ 37 ], 38 ); 39 } 40} 41 42/** 43 * Original thrift struct:- 44 * Color 45 */ 46class Color implements \IThriftStruct { 47 use \ThriftSerializationTrait; 48 49 const dict<int, this::TFieldSpec> SPEC = dict[ 50 1 => shape( 51 'var' => 'red', 52 'type' => \TType::DOUBLE, 53 ), 54 2 => shape( 55 'var' => 'green', 56 'type' => \TType::DOUBLE, 57 ), 58 3 => shape( 59 'var' => 'blue', 60 'type' => \TType::DOUBLE, 61 ), 62 4 => shape( 63 'var' => 'alpha', 64 'type' => \TType::DOUBLE, 65 ), 66 ]; 67 const dict<string, int> FIELDMAP = dict[ 68 'red' => 1, 69 'green' => 2, 70 'blue' => 3, 71 'alpha' => 4, 72 ]; 73 74 const type TConstructorShape = shape( 75 ?'red' => ?float, 76 ?'green' => ?float, 77 ?'blue' => ?float, 78 ?'alpha' => ?float, 79 ); 80 81 const int STRUCTURAL_ID = 5495510740722957663; 82 /** 83 * Original thrift field:- 84 * 1: double red 85 */ 86 public float $red; 87 /** 88 * Original thrift field:- 89 * 2: double green 90 */ 91 public float $green; 92 /** 93 * Original thrift field:- 94 * 3: double blue 95 */ 96 public float $blue; 97 /** 98 * Original thrift field:- 99 * 4: double alpha 100 */ 101 public float $alpha; 102 103 public function __construct(?float $red = null, ?float $green = null, ?float $blue = null, ?float $alpha = null )[] { 104 $this->red = $red ?? 0.0; 105 $this->green = $green ?? 0.0; 106 $this->blue = $blue ?? 0.0; 107 $this->alpha = $alpha ?? 0.0; 108 } 109 110 public static function withDefaultValues()[]: this { 111 return new static(); 112 } 113 114 public static function fromShape(self::TConstructorShape $shape)[]: this { 115 return new static( 116 Shapes::idx($shape, 'red'), 117 Shapes::idx($shape, 'green'), 118 Shapes::idx($shape, 'blue'), 119 Shapes::idx($shape, 'alpha'), 120 ); 121 } 122 123 public function getName()[]: string { 124 return 'Color'; 125 } 126 127 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 128 return tmeta_ThriftStruct::fromShape( 129 shape( 130 "name" => "module.Color", 131 "fields" => vec[ 132 tmeta_ThriftField::fromShape( 133 shape( 134 "id" => 1, 135 "type" => tmeta_ThriftType::fromShape( 136 shape( 137 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_DOUBLE_TYPE, 138 ) 139 ), 140 "name" => "red", 141 ) 142 ), 143 tmeta_ThriftField::fromShape( 144 shape( 145 "id" => 2, 146 "type" => tmeta_ThriftType::fromShape( 147 shape( 148 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_DOUBLE_TYPE, 149 ) 150 ), 151 "name" => "green", 152 ) 153 ), 154 tmeta_ThriftField::fromShape( 155 shape( 156 "id" => 3, 157 "type" => tmeta_ThriftType::fromShape( 158 shape( 159 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_DOUBLE_TYPE, 160 ) 161 ), 162 "name" => "blue", 163 ) 164 ), 165 tmeta_ThriftField::fromShape( 166 shape( 167 "id" => 4, 168 "type" => tmeta_ThriftType::fromShape( 169 shape( 170 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_DOUBLE_TYPE, 171 ) 172 ), 173 "name" => "alpha", 174 ) 175 ), 176 ], 177 "is_union" => false, 178 ) 179 ); 180 } 181 182 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 183 return shape( 184 'struct' => dict[], 185 'fields' => dict[ 186 ], 187 ); 188 } 189 190} 191 192/** 193 * Original thrift struct:- 194 * Vehicle 195 */ 196class Vehicle implements \IThriftStruct { 197 use \ThriftSerializationTrait; 198 199 const dict<int, this::TFieldSpec> SPEC = dict[ 200 1 => shape( 201 'var' => 'color', 202 'type' => \TType::STRUCT, 203 'class' => Color::class, 204 ), 205 2 => shape( 206 'var' => 'licensePlate', 207 'type' => \TType::STRING, 208 ), 209 3 => shape( 210 'var' => 'description', 211 'type' => \TType::STRING, 212 ), 213 4 => shape( 214 'var' => 'name', 215 'type' => \TType::STRING, 216 ), 217 5 => shape( 218 'var' => 'hasAC', 219 'type' => \TType::BOOL, 220 ), 221 ]; 222 const dict<string, int> FIELDMAP = dict[ 223 'color' => 1, 224 'licensePlate' => 2, 225 'description' => 3, 226 'name' => 4, 227 'hasAC' => 5, 228 ]; 229 230 const type TConstructorShape = shape( 231 ?'color' => ?Color, 232 ?'licensePlate' => ?string, 233 ?'description' => ?string, 234 ?'name' => ?string, 235 ?'hasAC' => ?bool, 236 ); 237 238 const int STRUCTURAL_ID = 2222890000100114781; 239 /** 240 * Original thrift field:- 241 * 1: struct module.Color color 242 */ 243 public ?Color $color; 244 /** 245 * Original thrift field:- 246 * 2: string licensePlate 247 */ 248 public ?string $licensePlate; 249 /** 250 * Original thrift field:- 251 * 3: string description 252 */ 253 public ?string $description; 254 /** 255 * Original thrift field:- 256 * 4: string name 257 */ 258 public ?string $name; 259 /** 260 * Original thrift field:- 261 * 5: bool hasAC 262 */ 263 public bool $hasAC; 264 265 public function __construct(?Color $color = null, ?string $licensePlate = null, ?string $description = null, ?string $name = null, ?bool $hasAC = null )[] { 266 $this->color = $color; 267 $this->licensePlate = $licensePlate; 268 $this->description = $description; 269 $this->name = $name; 270 $this->hasAC = $hasAC ?? false; 271 } 272 273 public static function withDefaultValues()[]: this { 274 return new static(); 275 } 276 277 public static function fromShape(self::TConstructorShape $shape)[]: this { 278 return new static( 279 Shapes::idx($shape, 'color'), 280 Shapes::idx($shape, 'licensePlate'), 281 Shapes::idx($shape, 'description'), 282 Shapes::idx($shape, 'name'), 283 Shapes::idx($shape, 'hasAC'), 284 ); 285 } 286 287 public function getName()[]: string { 288 return 'Vehicle'; 289 } 290 291 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 292 return tmeta_ThriftStruct::fromShape( 293 shape( 294 "name" => "module.Vehicle", 295 "fields" => vec[ 296 tmeta_ThriftField::fromShape( 297 shape( 298 "id" => 1, 299 "type" => tmeta_ThriftType::fromShape( 300 shape( 301 "t_struct" => tmeta_ThriftStructType::fromShape( 302 shape( 303 "name" => "module.Color", 304 ) 305 ), 306 ) 307 ), 308 "name" => "color", 309 ) 310 ), 311 tmeta_ThriftField::fromShape( 312 shape( 313 "id" => 2, 314 "type" => tmeta_ThriftType::fromShape( 315 shape( 316 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 317 ) 318 ), 319 "name" => "licensePlate", 320 "is_optional" => true, 321 ) 322 ), 323 tmeta_ThriftField::fromShape( 324 shape( 325 "id" => 3, 326 "type" => tmeta_ThriftType::fromShape( 327 shape( 328 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 329 ) 330 ), 331 "name" => "description", 332 "is_optional" => true, 333 ) 334 ), 335 tmeta_ThriftField::fromShape( 336 shape( 337 "id" => 4, 338 "type" => tmeta_ThriftType::fromShape( 339 shape( 340 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 341 ) 342 ), 343 "name" => "name", 344 "is_optional" => true, 345 ) 346 ), 347 tmeta_ThriftField::fromShape( 348 shape( 349 "id" => 5, 350 "type" => tmeta_ThriftType::fromShape( 351 shape( 352 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE, 353 ) 354 ), 355 "name" => "hasAC", 356 "is_optional" => true, 357 ) 358 ), 359 ], 360 "is_union" => false, 361 ) 362 ); 363 } 364 365 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 366 return shape( 367 'struct' => dict[], 368 'fields' => dict[ 369 ], 370 ); 371 } 372 373} 374 375/** 376 * Original thrift struct:- 377 * Person 378 */ 379class Person implements \IThriftStruct { 380 use \ThriftSerializationTrait; 381 382 const dict<int, this::TFieldSpec> SPEC = dict[ 383 1 => shape( 384 'var' => 'id', 385 'type' => \TType::I64, 386 ), 387 2 => shape( 388 'var' => 'name', 389 'type' => \TType::STRING, 390 ), 391 3 => shape( 392 'var' => 'age', 393 'type' => \TType::I16, 394 ), 395 4 => shape( 396 'var' => 'address', 397 'type' => \TType::STRING, 398 ), 399 5 => shape( 400 'var' => 'favoriteColor', 401 'type' => \TType::STRUCT, 402 'class' => Color::class, 403 ), 404 6 => shape( 405 'var' => 'friends', 406 'type' => \TType::SET, 407 'etype' => \TType::I64, 408 'elem' => shape( 409 'type' => \TType::I64, 410 ), 411 'format' => 'collection', 412 ), 413 7 => shape( 414 'var' => 'bestFriend', 415 'type' => \TType::I64, 416 ), 417 8 => shape( 418 'var' => 'petNames', 419 'type' => \TType::MAP, 420 'ktype' => \TType::I32, 421 'vtype' => \TType::STRING, 422 'key' => shape( 423 'type' => \TType::I32, 424 'enum' => Animal::class, 425 ), 426 'val' => shape( 427 'type' => \TType::STRING, 428 ), 429 'format' => 'collection', 430 ), 431 9 => shape( 432 'var' => 'afraidOfAnimal', 433 'type' => \TType::I32, 434 'enum' => Animal::class, 435 ), 436 10 => shape( 437 'var' => 'vehicles', 438 'type' => \TType::LST, 439 'etype' => \TType::STRUCT, 440 'elem' => shape( 441 'type' => \TType::STRUCT, 442 'class' => Vehicle::class, 443 ), 444 'format' => 'collection', 445 ), 446 ]; 447 const dict<string, int> FIELDMAP = dict[ 448 'id' => 1, 449 'name' => 2, 450 'age' => 3, 451 'address' => 4, 452 'favoriteColor' => 5, 453 'friends' => 6, 454 'bestFriend' => 7, 455 'petNames' => 8, 456 'afraidOfAnimal' => 9, 457 'vehicles' => 10, 458 ]; 459 460 const type TConstructorShape = shape( 461 ?'id' => ?int, 462 ?'name' => ?string, 463 ?'age' => ?int, 464 ?'address' => ?string, 465 ?'favoriteColor' => ?Color, 466 ?'friends' => ?Set<int>, 467 ?'bestFriend' => ?int, 468 ?'petNames' => ?Map<Animal, string>, 469 ?'afraidOfAnimal' => ?Animal, 470 ?'vehicles' => ?Vector<Vehicle>, 471 ); 472 473 const int STRUCTURAL_ID = 5615342512964403351; 474 /** 475 * Original thrift field:- 476 * 1: i64 id 477 */ 478 public int $id; 479 /** 480 * Original thrift field:- 481 * 2: string name 482 */ 483 public string $name; 484 /** 485 * Original thrift field:- 486 * 3: i16 age 487 */ 488 public ?int $age; 489 /** 490 * Original thrift field:- 491 * 4: string address 492 */ 493 public ?string $address; 494 /** 495 * Original thrift field:- 496 * 5: struct module.Color favoriteColor 497 */ 498 public ?Color $favoriteColor; 499 /** 500 * Original thrift field:- 501 * 6: set<i64> friends 502 */ 503 public ?Set<int> $friends; 504 /** 505 * Original thrift field:- 506 * 7: i64 bestFriend 507 */ 508 public ?int $bestFriend; 509 /** 510 * Original thrift field:- 511 * 8: map<enum module.Animal, string> petNames 512 */ 513 public ?Map<Animal, string> $petNames; 514 /** 515 * Original thrift field:- 516 * 9: enum module.Animal afraidOfAnimal 517 */ 518 public ?Animal $afraidOfAnimal; 519 /** 520 * Original thrift field:- 521 * 10: list<struct module.Vehicle> vehicles 522 */ 523 public ?Vector<Vehicle> $vehicles; 524 525 public function __construct(?int $id = null, ?string $name = null, ?int $age = null, ?string $address = null, ?Color $favoriteColor = null, ?Set<int> $friends = null, ?int $bestFriend = null, ?Map<Animal, string> $petNames = null, ?Animal $afraidOfAnimal = null, ?Vector<Vehicle> $vehicles = null )[] { 526 $this->id = $id ?? 0; 527 $this->name = $name ?? ''; 528 $this->age = $age; 529 $this->address = $address; 530 $this->favoriteColor = $favoriteColor; 531 $this->friends = $friends; 532 $this->bestFriend = $bestFriend; 533 $this->petNames = $petNames; 534 $this->afraidOfAnimal = $afraidOfAnimal; 535 $this->vehicles = $vehicles; 536 } 537 538 public static function withDefaultValues()[]: this { 539 return new static(); 540 } 541 542 public static function fromShape(self::TConstructorShape $shape)[]: this { 543 return new static( 544 Shapes::idx($shape, 'id'), 545 Shapes::idx($shape, 'name'), 546 Shapes::idx($shape, 'age'), 547 Shapes::idx($shape, 'address'), 548 Shapes::idx($shape, 'favoriteColor'), 549 Shapes::idx($shape, 'friends'), 550 Shapes::idx($shape, 'bestFriend'), 551 Shapes::idx($shape, 'petNames'), 552 Shapes::idx($shape, 'afraidOfAnimal'), 553 Shapes::idx($shape, 'vehicles'), 554 ); 555 } 556 557 public function getName()[]: string { 558 return 'Person'; 559 } 560 561 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 562 return tmeta_ThriftStruct::fromShape( 563 shape( 564 "name" => "module.Person", 565 "fields" => vec[ 566 tmeta_ThriftField::fromShape( 567 shape( 568 "id" => 1, 569 "type" => tmeta_ThriftType::fromShape( 570 shape( 571 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 572 shape( 573 "name" => "module.PersonID", 574 "underlyingType" => tmeta_ThriftType::fromShape( 575 shape( 576 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE, 577 ) 578 ), 579 ) 580 ), 581 ) 582 ), 583 "name" => "id", 584 ) 585 ), 586 tmeta_ThriftField::fromShape( 587 shape( 588 "id" => 2, 589 "type" => tmeta_ThriftType::fromShape( 590 shape( 591 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 592 ) 593 ), 594 "name" => "name", 595 ) 596 ), 597 tmeta_ThriftField::fromShape( 598 shape( 599 "id" => 3, 600 "type" => tmeta_ThriftType::fromShape( 601 shape( 602 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE, 603 ) 604 ), 605 "name" => "age", 606 "is_optional" => true, 607 ) 608 ), 609 tmeta_ThriftField::fromShape( 610 shape( 611 "id" => 4, 612 "type" => tmeta_ThriftType::fromShape( 613 shape( 614 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 615 ) 616 ), 617 "name" => "address", 618 "is_optional" => true, 619 ) 620 ), 621 tmeta_ThriftField::fromShape( 622 shape( 623 "id" => 5, 624 "type" => tmeta_ThriftType::fromShape( 625 shape( 626 "t_struct" => tmeta_ThriftStructType::fromShape( 627 shape( 628 "name" => "module.Color", 629 ) 630 ), 631 ) 632 ), 633 "name" => "favoriteColor", 634 "is_optional" => true, 635 ) 636 ), 637 tmeta_ThriftField::fromShape( 638 shape( 639 "id" => 6, 640 "type" => tmeta_ThriftType::fromShape( 641 shape( 642 "t_set" => tmeta_ThriftSetType::fromShape( 643 shape( 644 "valueType" => tmeta_ThriftType::fromShape( 645 shape( 646 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 647 shape( 648 "name" => "module.PersonID", 649 "underlyingType" => tmeta_ThriftType::fromShape( 650 shape( 651 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE, 652 ) 653 ), 654 ) 655 ), 656 ) 657 ), 658 ) 659 ), 660 ) 661 ), 662 "name" => "friends", 663 "is_optional" => true, 664 ) 665 ), 666 tmeta_ThriftField::fromShape( 667 shape( 668 "id" => 7, 669 "type" => tmeta_ThriftType::fromShape( 670 shape( 671 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 672 shape( 673 "name" => "module.PersonID", 674 "underlyingType" => tmeta_ThriftType::fromShape( 675 shape( 676 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE, 677 ) 678 ), 679 ) 680 ), 681 ) 682 ), 683 "name" => "bestFriend", 684 "is_optional" => true, 685 ) 686 ), 687 tmeta_ThriftField::fromShape( 688 shape( 689 "id" => 8, 690 "type" => tmeta_ThriftType::fromShape( 691 shape( 692 "t_map" => tmeta_ThriftMapType::fromShape( 693 shape( 694 "keyType" => tmeta_ThriftType::fromShape( 695 shape( 696 "t_enum" => tmeta_ThriftEnumType::fromShape( 697 shape( 698 "name" => "module.Animal", 699 ) 700 ), 701 ) 702 ), 703 "valueType" => tmeta_ThriftType::fromShape( 704 shape( 705 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 706 ) 707 ), 708 ) 709 ), 710 ) 711 ), 712 "name" => "petNames", 713 "is_optional" => true, 714 ) 715 ), 716 tmeta_ThriftField::fromShape( 717 shape( 718 "id" => 9, 719 "type" => tmeta_ThriftType::fromShape( 720 shape( 721 "t_enum" => tmeta_ThriftEnumType::fromShape( 722 shape( 723 "name" => "module.Animal", 724 ) 725 ), 726 ) 727 ), 728 "name" => "afraidOfAnimal", 729 "is_optional" => true, 730 ) 731 ), 732 tmeta_ThriftField::fromShape( 733 shape( 734 "id" => 10, 735 "type" => tmeta_ThriftType::fromShape( 736 shape( 737 "t_list" => tmeta_ThriftListType::fromShape( 738 shape( 739 "valueType" => tmeta_ThriftType::fromShape( 740 shape( 741 "t_struct" => tmeta_ThriftStructType::fromShape( 742 shape( 743 "name" => "module.Vehicle", 744 ) 745 ), 746 ) 747 ), 748 ) 749 ), 750 ) 751 ), 752 "name" => "vehicles", 753 "is_optional" => true, 754 ) 755 ), 756 ], 757 "is_union" => false, 758 ) 759 ); 760 } 761 762 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 763 return shape( 764 'struct' => dict[], 765 'fields' => dict[ 766 ], 767 ); 768 } 769 770} 771 772