1/*
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17include "module0.thrift"
18
19typedef string Plate
20typedef string State
21typedef i32 Year
22typedef list<string> Drivers
23typedef module0.Accessory Accessory
24typedef module0.PartName PartName
25
26struct Automobile {
27  1: Plate plate;
28  2: optional Plate previous_plate;
29  3: optional Plate first_plate = "0000";
30  4: Year year;
31  5: Drivers drivers;
32  6: list<Accessory> Accessories;
33  7: map<i32, PartName> PartNames;
34}
35
36// Test structs as map keys
37struct MapKey {
38  1: i64 num;
39  2: string strval;
40}
41
42struct MapContainer {
43  1: map<MapKey, string> mapval;
44}
45
46typedef Automobile Car
47
48service Finder {
49  Automobile byPlate(1: Plate plate);
50
51  Car aliasByPlate(1: Plate plate);
52
53  Plate previousPlate(1: Plate plate);
54}
55
56struct Pair {
57  1: Automobile automobile;
58  2: Car car;
59}
60
61struct Collection {
62  1: list<Automobile> automobiles;
63  2: list<Car> cars;
64}
65