/** * Booking related messages. * * This file is really just an example. The data model is completely * fictional. */ syntax = "proto2"; import "github.com/pseudomuto/protokit/fixtures/extend.proto"; package com.example; option (com.pseudomuto.protokit.v1.extend_file) = true; /** * Service for handling vehicle bookings. */ service BookingService { option (com.pseudomuto.protokit.v1.extend_service) = true; /// Used to book a vehicle. Pass in a Booking and a BookingStatus will be returned. rpc BookVehicle (Booking) returns (BookingStatus) { option (com.pseudomuto.protokit.v1.extend_method) = true; }; } /** * Represents the status of a vehicle booking. */ message BookingStatus { /** * A flag for the status result. */ enum StatusCode { OK = 200; // OK result. BAD_REQUEST = 400; // BAD result. } required int32 id = 1 [(com.pseudomuto.protokit.v1.extend_field) = true]; /// Unique booking status ID. required string description = 2; /// Booking status description. E.g. "Active". optional StatusCode status_code = 3; /// The status of this status? extensions 100 to max; } extend BookingStatus { /** The country the booking occurred in. */ optional string country = 100 [default = "china"]; } /** * The type of booking. */ enum BookingType { option (com.pseudomuto.protokit.v1.extend_enum) = true; IMMEDIATE = 100; // Immediate booking. FUTURE = 101 [(com.pseudomuto.protokit.v1.extend_enum_value) = true]; // Future booking. } /** * Represents the booking of a vehicle. * * Vehicles are some cool shit. But drive carefully! */ message Booking { option (com.pseudomuto.protokit.v1.extend_message) = true; required int32 vehicle_id = 1; /// ID of booked vehicle. required int32 customer_id = 2; /// Customer that booked the vehicle. required BookingStatus status = 3; /// Status of the booking. /** Has booking confirmation been sent? */ required bool confirmation_sent = 4; /** Has payment been received? */ optional bool payment_received = 5 [default = false, (com.pseudomuto.protokit.v1.extend_field) = true]; optional string color_preference = 6 [deprecated=true]; // Color preference of the customer. // Nested extentions are also a thing. extend BookingStatus { optional string optional_field_1 = 101; // An optional field to be used however you please. } }