Skip to content

Commit

Permalink
Search restructure with SearchQuery concept (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
havan authored Jan 17, 2024
1 parent 8530018 commit f20e9a1
Show file tree
Hide file tree
Showing 24 changed files with 554 additions and 241 deletions.
39 changes: 39 additions & 0 deletions proto/cmp/services/accommodation/v1alpha1/info.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
syntax = "proto3";

package cmp.services.accommodation.v1alpha1;

import "cmp/services/accommodation/v1alpha1/property_types.proto";
import "cmp/types/v1alpha1/common.proto";
import "cmp/types/v1alpha1/language.proto";
import "google/protobuf/timestamp.proto";

message AccommodationProductInfoRequest {
// Message header
cmp.types.v1alpha1.Header header = 1;

// Only respond with the products that are modified after this timestamp
google.protobuf.Timestamp modified_after = 2;

// Languages
repeated cmp.types.v1alpha1.Language languages = 3;

// Property codes
repeated string property_codes = 4;
}

message AccommodationProductInfoResponse {
// Message header
cmp.types.v1alpha1.Header header = 1;

// Product list: Properties
repeated PropertyExtendedInfo properties = 2;
}

// Accommodation product info service definition
//
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/info.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/info.proto.dot.svg)
service AccommodationProductInfoService {
// Returns product list for accommodation (properties)
rpc AccommodationProductInfo(AccommodationProductInfoRequest) returns (AccommodationProductInfoResponse);
}
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
106 changes: 106 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,16 @@ syntax = "proto3";
package cmp.services.accommodation.v1alpha1;

import "cmp/types/v1alpha1/address.proto";
import "cmp/types/v1alpha1/amenity.proto";
import "cmp/types/v1alpha1/bed.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/service_fact.proto";
import "cmp/types/v1alpha1/traveller.proto";
import "google/protobuf/timestamp.proto";

// ### Property message type
Expand Down Expand Up @@ -92,3 +99,102 @@ 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
PropertyStatus status = 8;

// Rooms
repeated Room rooms = 9;
}

enum PropertyStatus {
PROPERTY_STATUS_UNSPECIFIED = 0;
PROPERTY_STATUS_DRAFT = 1;
PROPERTY_STATUS_CONFIRMED = 2;
PROPERTY_STATUS_EXPIRED = 3;
}

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)
repeated cmp.types.v1alpha1.MealPlan meal_plan = 6;

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

// Occupancy
Occupancy total_occupancy = 8;

// Services
repeated cmp.types.v1alpha1.ServiceFact services = 9;

// Amenities
repeated cmp.types.v1alpha1.Amenity amenities = 10;
}

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

0 comments on commit f20e9a1

Please sign in to comment.