Skip to content

Commit

Permalink
introduce search query concept, property product extended info
Browse files Browse the repository at this point in the history
  • Loading branch information
havan committed Jan 13, 2024
1 parent 82d14dd commit 02e1992
Show file tree
Hide file tree
Showing 19 changed files with 375 additions and 146 deletions.
110 changes: 110 additions & 0 deletions proto/cmp/services/accommodation/v1alpha1/property_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ syntax = "proto3";
package cmp.services.accommodation.v1alpha1;

import "cmp/types/v1alpha1/address.proto";
import "cmp/types/v1alpha1/bed.proto";
import "cmp/types/v1alpha1/cancel_policy.proto";
import "cmp/types/v1alpha1/description.proto";
import "cmp/types/v1alpha1/email.proto";
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";

// ### Property message type
Expand Down Expand Up @@ -92,3 +100,105 @@ enum CategoryUnit {
CATEGORY_UNIT_STARS = 1;
CATEGORY_UNIT_PALMS = 2;
}

// This message type contains extended info about a property
message PropertyExtendedInfo {
// Property
Property property = 1;

// Images
repeated cmp.types.v1alpha1.Image images = 2;

// Videos
repeated cmp.types.v1alpha1.Video videos = 3;

// Segmentation classification
repeated string classification = 4;

// Property descriptions
repeated cmp.types.v1alpha1.LocalizedDescriptionSet localized_descriptions = 5;

// Room descriptions
repeated cmp.types.v1alpha1.LocalizedDescriptionSet localized_room_descriptions = 6;

// Payment type. Ex: "MERCHANT"
string payment_type = 7;

// Status. FIXME: This needs to be an enum!?
string status = 8;
}

message Room {
string code = 1;
string name = 2;
repeated cmp.types.v1alpha1.Image images = 3;
repeated cmp.types.v1alpha1.Video videos = 4;

// Room descriptions
repeated cmp.types.v1alpha1.LocalizedDescriptionSet descriptions = 5;

// Meal plan (Board code)
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;

// Occupancy
Occupancy occupancy = 10;

// 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;

// 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;
}

message Occupancy {
// Min guests
int32 min_guests = 1;

// Max guests
int32 max_guests = 2;

// Standard occupancy
int32 standard_occupancy = 3;

// Full payers
int32 full_payers = 4;

// If infants are counted in total guests or not
bool infant_counted_in_total_guests = 5;

// Occupancy options
repeated OccupancyOption occupancy_options = 6;
}

message OccupancyOption {
// Guest type like adult, child, infant.
cmp.types.v1alpha1.TravellerType guest_type = 1;

// Min guests
int32 min = 2;

// Max guests
int32 max = 3;

// Min age
int32 min_age = 4;

// Max age
int32 max_age = 5;
}
55 changes: 19 additions & 36 deletions proto/cmp/services/accommodation/v1alpha1/search.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,28 @@ syntax = "proto3";
// This package is a **WIP**.
package cmp.services.accommodation.v1alpha1;

import "cmp/services/accommodation/v1alpha1/search_parameters_types.proto";
import "cmp/services/accommodation/v1alpha1/search_query_types.proto";
import "cmp/services/accommodation/v1alpha1/search_result_types.proto";
import "cmp/services/accommodation/v1alpha1/unit_types.proto";
import "cmp/types/v1alpha1/common.proto";
import "cmp/types/v1alpha1/search.proto";
import "cmp/types/v1alpha1/travel_period.proto";
import "cmp/types/v1alpha1/traveller.proto";

// ### Accommodation Search Request Message Type
//
// The `Accommodation Search Request` message type facilitates the request for
// accommodations like hotel and holiday home searches within the platform. In the
// request the market, language and currency are specified at the top-level.
//
// In the Unit we specify the details of the trip like dates, properties or locations or
// filters. The purpose of such a structure is to allow for multi-room and
// multi-property searches.
// This means that there is no grouping of different room, mealplan or rateplan options
// in single room or single property searches. Each AccommodationSearchResult is one
// bookable option.
// request the market, language and currency are specified at the top-level.
//
// In the Unit we specify the details of the trip like dates, properties or
// locations or filters. The purpose of such a structure is to allow for multi-room
// and multi-property searches. This means that there is no grouping of different
// room, mealplan or rateplan options in single room or single property searches.
// Each AccommodationSearchResult is one bookable option.
//
// Several rooms or houses can be requested for the same dates and location or
// for the purpose of a tour or roadtrip, several accommodations or properties for
// sequential dates and different locations. This is done by specifying multiple Units
// for the same or different periods, the same or different accommodations or properties,
// specifying which travellers sleep in which unit.
//
//// Developers leveraging this message type should ensure proper validation and
// Several rooms or houses can be requested for the same dates and location or for
// the purpose of a tour or roadtrip, several accommodations or properties for
// sequential dates and different locations. This is done by specifying multiple
// Units for the same or different periods, the same or different accommodations or
// properties, specifying which travellers sleep in which unit.
//
// Developers leveraging this message type should ensure proper validation and
// handling, especially considering fields that are still under review, like
// `speech_request`.
message AccommodationSearchRequest {
Expand All @@ -54,22 +48,11 @@ message AccommodationSearchRequest {
// only the cheapest or all options.
cmp.types.v1alpha1.SearchParameters search_parameters_generic = 3;

// Accommodation specific search parameters Ex: Specific search parameters like
// geo location, meal plan, rate plan and rate rules.
AccommodationSearchParameters search_parameters_accommodation = 4;

// Travel period
cmp.types.v1alpha1.TravelPeriod travel_period = 5;

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

// Unit Types
repeated UnitType unit_types = 7;
// This field represents a list of search queries that can be used to create
// multiroom multi location searches.
repeated AccommodationSearchQuery queries = 4;
}

// ### Accommodation Search Response
//
// The `Accommodation Search Response` message type facilitates the response for
// accommodations like hotel and holiday home searches within the platform.
//
Expand All @@ -89,7 +72,7 @@ message AccommodationSearchResponse {
repeated AccommodationSearchResult results = 3;
}

// ### Accommodation Search Service definition
// Service definition for Accommodation search
//
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/search.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/search.proto.dot.svg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ package cmp.services.accommodation.v1alpha1;

import "cmp/types/v1alpha1/location.proto";
import "cmp/types/v1alpha1/meal_plan.proto";
import "cmp/types/v1alpha1/rate.proto";
import "cmp/types/v1alpha1/product_code.proto";
import "cmp/types/v1alpha1/rate.proto";

// ### Accommodation Search Parameters
// This type is used in search requests for parameters like location, meal plan
// codes etc.
//
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/search_parameters_types.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/search_parameters_types.proto.dot.svg)
Expand Down Expand Up @@ -46,4 +47,4 @@ message AccommodationSearchParameters {
// Product code list
// Here a list of property codes would be used
repeated cmp.types.v1alpha1.ProductCode product_codes = 9;
}
}
29 changes: 29 additions & 0 deletions proto/cmp/services/accommodation/v1alpha1/search_query_types.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
syntax = "proto3";

package cmp.services.accommodation.v1alpha1;

import "cmp/services/accommodation/v1alpha1/search_parameters_types.proto";
import "cmp/services/accommodation/v1alpha1/unit_types.proto";
import "cmp/types/v1alpha1/travel_period.proto";
import "cmp/types/v1alpha1/traveller.proto";

message AccommodationSearchQuery {
// Integer query ID, unique per search request
int32 query_id = 1;

// Accommodation specific search parameters Ex: Specific search parameters like
// geo location, meal plan, rate plan and rate rules.
AccommodationSearchParameters search_parameters_accommodation = 2;

// Travel period
cmp.types.v1alpha1.TravelPeriod travel_period = 3;

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

// Total number of rooms / holiday homes
int32 unit_count = 5;

// Type of the unit, like room or holiday home
UnitType unit_type = 6;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import "cmp/types/v1alpha1/cancel_policy.proto";
import "cmp/types/v1alpha1/price.proto";
import "cmp/types/v1alpha1/rate.proto";

// ### Search result type for Accommodation Search Service
//
// This type represents a search result and is used in the
// `AccommodationSearchResponse` message.
//
Expand All @@ -19,18 +17,21 @@ message AccommodationSearchResult {
// increasing by 1 for every search result.
int32 result_id = 1;

// This field represents the query ID associated with the search result.
int32 query_id = 2;

// Units for this search result
repeated Unit units = 2;
repeated Unit units = 3;

// ## Total price in detail, with breakdowns
cmp.types.v1alpha1.PriceDetail total_price_detail = 3;
cmp.types.v1alpha1.PriceDetail total_price_detail = 4;

// The RateRule specifies whether a search result is non-refundable or not
repeated cmp.types.v1alpha1.RateRule rate_rules = 4;
repeated cmp.types.v1alpha1.RateRule rate_rules = 5;

// The cancellation conditions related to an option
cmp.types.v1alpha1.CancelPolicy cancel_policy = 5;
cmp.types.v1alpha1.CancelPolicy cancel_policy = 6;

// Freetext remarks without any functionality
string remarks = 6;
string remarks = 7;
}
27 changes: 8 additions & 19 deletions proto/cmp/services/accommodation/v1alpha1/unit_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ syntax = "proto3";

package cmp.services.accommodation.v1alpha1;

import "cmp/types/v1alpha1/bed.proto";
import "cmp/types/v1alpha1/cancel_policy.proto";
import "cmp/types/v1alpha1/meal_plan.proto";
import "cmp/types/v1alpha1/price.proto";
import "cmp/types/v1alpha1/product_code.proto";
import "cmp/types/v1alpha1/rate.proto";
import "cmp/types/v1alpha1/service_fact.proto";
import "cmp/types/v1alpha1/travel_period.proto";
import "cmp/types/v1alpha1/traveller.proto";

// ### Unit
//
// A Unit can represent a room in a hotel. One search option can have multiple units
// for multi-room requests Ex: one request for 2 rooms for 4 adults, 2 in each room.
//
// A unit can also be a different property in a multi-property request for holiday
// homes. Ex: 1 house for 4 persons and another house for 6 persons.
//
Expand All @@ -38,7 +39,7 @@ message Unit {
repeated cmp.types.v1alpha1.Traveller travellers = 5;

// Beds
repeated Bed beds = 6;
repeated cmp.types.v1alpha1.Bed beds = 6;

// Price in detail with breakdowns etc
cmp.types.v1alpha1.PriceDetail price_detail = 7;
Expand All @@ -57,35 +58,23 @@ message Unit {
// Rate Rule
cmp.types.v1alpha1.RateRule rate_rule = 13;

// Cancel Policies
// This is a list so that various policies can be expressed
// 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;

// Remaining units
int32 remaining_units = 15;

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

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

message Bed {
BedType type = 1;
int32 count = 2;
}

enum BedType {
BED_TYPE_UNSPECIFIED = 0;
BED_TYPE_SINGLE = 1;
BED_TYPE_DOUBLE = 2;
BED_TYPE_KING = 3;
}

enum UnitType {
UNIT_TYPE_UNSPECIFIED = 0;
UNIT_TYPE_ROOM = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import "cmp/types/v1alpha1/location.proto";
import "cmp/types/v1alpha1/price.proto";
import "google/protobuf/timestamp.proto";

// ### Search option type for Activity Search Service
// This type represents a search result and is used in the `ActivitySearchResponse`
// message.
//
// This type represents a search result and is used in the
// `ActivitySearchResponse` message.
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/activity/v1alpha1/search_option_types.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/activity/v1alpha1/search_option_types.proto.dot.svg)
message ActivitySearchResult {
Expand Down Expand Up @@ -115,7 +114,7 @@ message PickupDropoffEvent {
// Ex: "OTHERS / Parking Varadero(bus stop css nº50)",
string other_info = 4;

// Ex: "2023-07-15T09:05:00"
// Datetime of the pickup dropoff event as Unix timestamp
google.protobuf.Timestamp date_time = 5;
}

Expand Down
Loading

0 comments on commit 02e1992

Please sign in to comment.