Skip to content

Commit

Permalink
implement multiple queries for transport, refactor service fact
Browse files Browse the repository at this point in the history
WIP accommodation product info
  • Loading branch information
havan committed Jan 15, 2024
1 parent d5f9091 commit 6aa0376
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 134 deletions.
2 changes: 1 addition & 1 deletion proto/cmp/services/accommodation/v1alpha1/list.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ message AccommodationProductListResponse {
repeated Property properties = 2;
}

// ### Accommodation Product List Service
// Accommodation product list service definition
//
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/list.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/list.proto.dot.svg)
Expand Down
19 changes: 5 additions & 14 deletions proto/cmp/services/accommodation/v1alpha1/property_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import "cmp/types/v1alpha1/file.proto";
import "cmp/types/v1alpha1/location.proto";
import "cmp/types/v1alpha1/meal_plan.proto";
import "cmp/types/v1alpha1/phone.proto";
import "cmp/types/v1alpha1/rate.proto";
import "cmp/types/v1alpha1/service_fact.proto";
import "cmp/types/v1alpha1/traveller.proto";
import "google/protobuf/timestamp.proto";
Expand Down Expand Up @@ -134,7 +133,7 @@ enum PropertyStatus {
PROPERTY_STATUS_UNSPECIFIED = 0;
PROPERTY_STATUS_DRAFT = 1;
PROPERTY_STATUS_CONFIRMED = 2;
PROPERTY_STATUS_RETIRED = 3;
PROPERTY_STATUS_EXPIRED = 3;
}

message Room {
Expand All @@ -147,26 +146,18 @@ message Room {
repeated cmp.types.v1alpha1.LocalizedDescriptionSet descriptions = 5;

// Meal plan (Board code)
cmp.types.v1alpha1.MealPlan meal_plan = 6;
repeated cmp.types.v1alpha1.MealPlan meal_plan = 6;

// FIXME: Need board description & amenities here

// Rate plans
repeated cmp.types.v1alpha1.RatePlan rate_plans = 7;

// Rate Rule
repeated cmp.types.v1alpha1.RateRule rate_rules = 8;

// Beds
repeated cmp.types.v1alpha1.Bed beds = 9;
repeated cmp.types.v1alpha1.Bed beds = 7;

// Occupancy
Occupancy occupancy = 10;
Occupancy total_occupancy = 8;

// Services
repeated cmp.types.v1alpha1.ServiceFact included_services = 11;
repeated cmp.types.v1alpha1.ServiceFact compulsory_extras = 12;
repeated cmp.types.v1alpha1.ServiceFact optional_extras = 13;
repeated cmp.types.v1alpha1.ServiceFact services = 9;
}

message Occupancy {
Expand Down
20 changes: 9 additions & 11 deletions proto/cmp/services/accommodation/v1alpha1/unit_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,38 +41,36 @@ message Unit {
// Beds
repeated cmp.types.v1alpha1.Bed beds = 6;

// Price in detail with breakdowns etc
// Price in detail with breakdowns
cmp.types.v1alpha1.PriceDetail price_detail = 7;

// Services
repeated cmp.types.v1alpha1.ServiceFact included_services = 8;
repeated cmp.types.v1alpha1.ServiceFact compulsory_extras = 9;
repeated cmp.types.v1alpha1.ServiceFact optional_extras = 10;
repeated cmp.types.v1alpha1.ServiceFact services = 8;

// Mealplan code
cmp.types.v1alpha1.MealPlan meal_plan_code = 11;
cmp.types.v1alpha1.MealPlan meal_plan_code = 9;

// Rate plan
cmp.types.v1alpha1.RatePlan rate_plan = 12;
cmp.types.v1alpha1.RatePlan rate_plan = 10;

// Rate Rule
cmp.types.v1alpha1.RateRule rate_rule = 13;
cmp.types.v1alpha1.RateRule rate_rule = 11;

// This is a list so that various policies can be expressed.
//
// Ex: 10-5 days before arrival x€, 4-1 days before arrival y€ and 0 days before
// arrival z€
repeated cmp.types.v1alpha1.CancelPolicy cancel_policies = 14;
repeated cmp.types.v1alpha1.CancelPolicy cancel_policies = 12;

// Remaining units
int32 remaining_units = 15;
int32 remaining_units = 13;

// Property code
cmp.types.v1alpha1.ProductCode property_code = 16;
cmp.types.v1alpha1.ProductCode property_code = 14;

// Remarks
// FIXME: Is this field "per Unit" or should it be "per search request"?
string remarks = 17;
string remarks = 15;
}

enum UnitType {
Expand Down
16 changes: 4 additions & 12 deletions proto/cmp/services/transport/v1alpha1/search.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ package cmp.services.transport.v1alpha1;

import "cmp/services/transport/v1alpha1/search_query_types.proto";
import "cmp/services/transport/v1alpha1/search_result_types.proto";
import "cmp/services/transport/v1alpha1/source_types.proto";
import "cmp/types/v1alpha1/common.proto";
import "cmp/types/v1alpha1/content_source.proto";
import "cmp/types/v1alpha1/search.proto";

// ### Transport Search Request
Expand All @@ -32,19 +32,11 @@ message TransportSearchRequest {
// options.
cmp.types.v1alpha1.SearchParameters search_parameters = 3;

// Content source types for this search request to specify which sources to
// include.
//
// Ex: ContentSourceType.CONTENT_SOURCE_TYPE_GDS,
// ContentSourceType.CONTENT_SOURCE_TYPE_NDC
// ContentSourceType.CONTENT_SOURCE_TYPE_3RD_PARTY
repeated ContentSourceType conten_source_types = 4;

// Multiple search queries for this search request
repeated TransportSearchQuery queries = 5;
repeated TransportSearchQuery queries = 4;

// Remarks
string remarks = 9;
string remarks = 5;
}

message TransportSearchResponse {
Expand All @@ -60,7 +52,7 @@ message TransportSearchResponse {
// Ex: ContentSourceType.CONTENT_SOURCE_TYPE_GDS,
// ContentSourceType.CONTENT_SOURCE_TYPE_NDC
// ContentSourceType.CONTENT_SOURCE_TYPE_3RD_PARTY
repeated ContentSourceType conten_source_types = 3;
repeated cmp.types.v1alpha1.ContentSourceType conten_source_types = 3;

// Transit search results
repeated TransportSearchResult results = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,15 @@ message TransportSearchParameters {
// one.
int32 max_segments = 7;

// Minimum departure time of the travelling trip
cmp.types.v1alpha1.Time travelling_min_departure_time = 8;
// Minimum departure time of the trip
cmp.types.v1alpha1.Time trip_min_departure_time = 8;

// Maximum departure time of the travelling trip
cmp.types.v1alpha1.Time travelling_max_departure_time = 9;
// Maximum departure time of the trip
cmp.types.v1alpha1.Time trip_max_departure_time = 9;

// Minimum arrival time of the travelling trip
cmp.types.v1alpha1.Time travelling_min_arrival_time = 10;
// Minimum arrival time of the trip
cmp.types.v1alpha1.Time trip_min_arrival_time = 10;

// Maximum arrival time of the travelling trip
cmp.types.v1alpha1.Time travelling_max_arrival_time = 11;

// Minimum departure time of the returning trip
cmp.types.v1alpha1.Time returning_min_departure_time = 12;

// Maximum departure time of the returning trip
cmp.types.v1alpha1.Time returning_max_departure_time = 13;

// Minimum arrival time of the returning trip
cmp.types.v1alpha1.Time returning_min_arrival_time = 14;

// Maximum arrival time of the returning trip
cmp.types.v1alpha1.Time returning_max_arrival_time = 15;
// Maximum arrival time of the trip
cmp.types.v1alpha1.Time trip_max_arrival_time = 11;
}
42 changes: 24 additions & 18 deletions proto/cmp/services/transport/v1alpha1/search_query_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ syntax = "proto3";
package cmp.services.transport.v1alpha1;

import "cmp/services/transport/v1alpha1/search_parameters_types.proto";
import "cmp/services/transport/v1alpha1/trip_types.proto";
import "cmp/types/v1alpha1/date.proto";
import "cmp/types/v1alpha1/location.proto";
import "cmp/types/v1alpha1/traveller.proto";

// Transport search query
Expand All @@ -15,23 +16,28 @@ message TransportSearchQuery {
int32 query_id = 1;

// Transport specific search parameters
TransportSearchParameters search_parameters_transport = 4;
TransportSearchParameters search_parameters_transport = 2;

// Travellers
repeated cmp.types.v1alpha1.Traveller travellers = 6;

// Travelling trip
//
// To avoid confusion of the direction of travel that occurs with terms like
// "inbound" and "outbound". The travelling trip is also used for "one way" in
// which case the returning trip is omitted. For tours or roadtrips, multiple
// requests with just a travelling trip for sequential dates can be submitted to
// specific suppliers of each part of tour or roadtrip.
Trip travelling_trip = 7;

// Returning trip
//
// In many cases our travel plans consist of going to a destination and return to
// the same place where we started.
Trip returning_trip = 8;
repeated cmp.types.v1alpha1.Traveller travellers = 3;

// Trips
repeated QueryTrip trips = 4;
}

message QueryTrip {
// Departure event
QueryTransitEvent departure = 1;

// Arrival event
QueryTransitEvent arrival = 2;
}

// Represents a departure or arrival event
message QueryTransitEvent {
// Date time of the event
cmp.types.v1alpha1.Date date = 1;

// Event location
cmp.types.v1alpha1.LocationCode location_code = 2;
}
14 changes: 6 additions & 8 deletions proto/cmp/services/transport/v1alpha1/search_result_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,24 @@ message TransportSearchResult {
cmp.types.v1alpha1.PriceDetail total_price = 6;

// Services
repeated cmp.types.v1alpha1.ServiceFact included_services = 7;
repeated cmp.types.v1alpha1.ServiceFact compulsory_extras = 8;
repeated cmp.types.v1alpha1.ServiceFact optional_extras = 9;
repeated cmp.types.v1alpha1.ServiceFact services = 7;

// Rate Rules
repeated cmp.types.v1alpha1.RateRule rate_rules = 10;
repeated cmp.types.v1alpha1.RateRule rate_rules = 8;

// Fulfillment
repeated cmp.types.v1alpha1.Fulfillment fulfillments = 11; //FIXME: Can linktype be an ENUM?
repeated cmp.types.v1alpha1.Fulfillment fulfillments = 9; //FIXME: Can linktype be an ENUM?

// Validity of the search option.
//
// `DateTimeRange` type with `start_date` and `end_date` in which the option can
// be booked. If the start_date is omitted, the offer can be booked until the
// end-date.
cmp.types.v1alpha1.DateTimeRange validity = 12;
cmp.types.v1alpha1.DateTimeRange validity = 10;

// Cancel Policy
cmp.types.v1alpha1.CancelPolicy cancel_policy = 13;
cmp.types.v1alpha1.CancelPolicy cancel_policy = 11;

// Observations
string observations = 14;
string observations = 12;
}
34 changes: 12 additions & 22 deletions proto/cmp/services/transport/v1alpha1/trip_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,25 @@ import "google/protobuf/timestamp.proto";
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/transport/v1alpha1/trip_types.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/transport/v1alpha1/trip_types.proto.dot.svg)
message Trip {
// Departure min time
google.protobuf.Timestamp departure_min_time = 1;

// Departure max time
google.protobuf.Timestamp departure_max_time = 2;

// Departure event
TransitEvent departure = 3;
TransitEvent departure = 1;

// Arrival event
TransitEvent arrival = 4;
TransitEvent arrival = 2;

// Trip segments
repeated TripSegment trip_segments = 5;
repeated TripSegment segments = 3;
}

// Represents a departure or arrival event
message TransitEvent {
// Date time of the event
google.protobuf.Timestamp date_time = 1;

// Event location
cmp.types.v1alpha1.LocationCode location_code = 2;
}

// ### Trip Segment messag type
//
// A segment of a trip
message TripSegment {
// Segment ID
Expand Down Expand Up @@ -105,14 +106,3 @@ message TripSegment {
// Ex: `Price(net=240, currency=Currency.CURRENCY_EUR)
cmp.types.v1alpha1.Price price = 15;
}

// ### Transit Event message type
//
// Represents a departure or arrival event
message TransitEvent {
// Date tim of the event
google.protobuf.Timestamp date_time = 1;

// Event location
cmp.types.v1alpha1.LocationCode location_code = 2;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
syntax = "proto3";

package cmp.services.transport.v1alpha1;
package cmp.types.v1alpha1;

// ### Content Source Type message type
//
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/transport/v1alpha1/source_types.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/transport/v1alpha1/source_types.proto.dot.svg)
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/content_source.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/content_source.proto.dot.svg)
enum ContentSourceType {
CONTENT_SOURCE_TYPE_UNSPECIFIED = 0;
CONTENT_SOURCE_TYPE_GDS = 1;
Expand Down
9 changes: 9 additions & 0 deletions proto/cmp/types/v1alpha1/search.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";

package cmp.types.v1alpha1;

import "cmp/types/v1alpha1/content_source.proto";
import "cmp/types/v1alpha1/country.proto";
import "cmp/types/v1alpha1/currency.proto";
import "cmp/types/v1alpha1/filter.proto";
Expand Down Expand Up @@ -50,6 +51,14 @@ message SearchParameters {
// personalization. This field can be provided in combination with a Geo location
// or as stand-alone.
string search_description_audio_url = 10;

// Content source types for this search request to specify which sources to
// include.
//
// Ex: ContentSourceType.CONTENT_SOURCE_TYPE_GDS,
// ContentSourceType.CONTENT_SOURCE_TYPE_NDC
// ContentSourceType.CONTENT_SOURCE_TYPE_3RD_PARTY
repeated ContentSourceType content_source_types = 11;
}

// This message type is used in every search request to contain the request metadata
Expand Down
Loading

0 comments on commit 6aa0376

Please sign in to comment.