-
Notifications
You must be signed in to change notification settings - Fork 7
/
vehicle.proto
95 lines (76 loc) · 2.56 KB
/
vehicle.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/** Messages describing manufacturers / vehicles. */
syntax = "proto2";
package com.example;
option go_package = "example.com/vehicle";
enum Coolness {
COOLNESS_UNSPECIFIED = 0; /** The coolness is unknown. */
COOLNESS_MAX = 1; /** The coolness is maximum. */
}
/**
* Represents a manufacturer of cars.
*/
message Manufacturer {
/**
* Manufacturer category. A manufacturer may be either inhouse or external.
*/
enum Category {
CATEGORY_INHOUSE = 0; /** The manufacturer is inhouse. */
CATEGORY_EXTERNAL = 1; /** The manufacturer is external. */
}
required int32 id = 1; /** The unique manufacturer ID. */
required string code = 2; /** A manufacturer code, e.g. "DKL4P". */
optional string details = 3; /** Manufacturer details (minimum orders et.c.). */
/** Manufacturer category. */
optional Category category = 4 [default = CATEGORY_EXTERNAL];
extensions 100 to max;
}
// File-level extensions can also be documented:
extend Manufacturer {
/** Manufacturer country. */
optional string country = 100 [default = "China"];
}
/**
* Represents a vehicle model.
*/
message Model {
required string id = 1; /** The unique model ID. */
required string model_code = 2; /** The car model code, e.g. "PZ003". */
required string model_name = 3; /** The car model name, e.g. "Z3". */
required sint32 daily_hire_rate_dollars = 4; /// Dollars per day.
required sint32 daily_hire_rate_cents = 5; /// Cents per day.
extensions 100 to max;
}
/**
* Represents a vehicle that can be hired.
*/
message Vehicle {
/**
* Represents a vehicle category. E.g. "Sedan" or "Truck".
*/
message Category {
required string code = 1; /// Category code. E.g. "S".
required string description = 2; /// Category name. E.g. "Sedan".
}
required int32 id = 1; /** Unique vehicle ID. */
required Model model = 2; /** Vehicle model. */
required string reg_number = 3; /** Vehicle registration number. */
optional sint32 mileage = 4; /** Current vehicle mileage, if known. */
optional Category category = 5; /** Vehicle category. */
// Doc comments for fields can come before or
// after the field definition. And just like
// comments for messages / enums, they can be
// multi-paragraph:
/**
* Dollars per day.
*/
optional sint32 daily_hire_rate_dollars = 6 [default = 50];
/**
* Cents per day.
*/
optional sint32 daily_hire_rate_cents = 7;
// Nested extensions can also be documented:
extend Model {
/** Vehicle model series. */
optional string series = 100;
}
}