diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..f617e079 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +* @havan +* @SamJaarsma \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..dafd83c9 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,108 @@ +name: CI + +on: + push: + # Only run when there are changes under proto dir + paths: + - "proto/**" + - ".github/workflows/**" + pull_request: + # Only run when there are changes under proto dir + paths: + - "proto/**" + - ".github/workflows/**" + +jobs: + # Run buf's lint to check for errros + buf-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout the repo + uses: actions/checkout@v4 + - name: Install buf + run: | + # Installing buf + if [ "${{ env.buf_version }}" == "" ]; then + # Install latest version + sudo ./scripts/buf-installer.sh + else + # Install the defined version + sudo ./scripts/buf-installer.sh --version=${{ env.buf_version}} + fi + - name: Buf lint + uses: bufbuild/buf-lint-action@v1 + with: + input: "proto" + # Push the draft branch to buf.build + bsr-push-draft: + runs-on: ubuntu-latest + needs: buf-lint + if: github.ref == 'refs/heads/draft' + environment: draft + steps: + - name: Checkout the repo + uses: actions/checkout@v4 + - name: Install Buf + run: | + # Install Buf + if [ "${{ env.buf_version }}" == "" ]; then + # Install latest version + sudo ./scripts/buf-installer.sh + else + # Install the defined version + sudo ./scripts/buf-installer.sh --version=${{ env.buf_version}} + fi + - name: Push to buf.build + uses: bufbuild/buf-push-action@v1 + with: + input: "proto" + draft: true + buf_token: ${{ secrets.BUF_BSR_TOKEN }} + + # Generate and upload protodot diagrams + diagrams: + runs-on: ubuntu-latest + needs: buf-lint + if: github.ref == 'refs/heads/draft' + steps: + # Setup environment + - name: Checkout the repo + uses: actions/checkout@v4 + - name: Setup Graphviz + uses: ts-graphviz/setup-graphviz@v1 + - name: Install librsvg2-bin + run: sudo apt-get install -y librsvg2-bin + + # Generate diagrams + - name: Generate Diagrams + run: | + # Install protodot + wget https://github.com/seamia/protodot/raw/master/binaries/protodot-linux-amd64 + chmod +x protodot-linux-amd64 + mkdir -v -p gen/bin + mv protodot-linux-amd64 gen/bin/protodot + export PATH=${PWD}/gen/bin:${PATH} + + # Run generator script + bash scripts/generate_protodot.sh + + # Remove .dot files, we do not need them. + find gen/diagrams -type f -name "*.dot" -exec rm -f {} + + + # Show generated files + tree gen/diagrams + + # Upload diagrams + - name: Cloud Authentication + id: auth + uses: "google-github-actions/auth@v1" + with: + credentials_json: "${{ secrets.GOOGLE_CREDENTIALS }}" + + - name: Setup Cloud SDK + uses: google-github-actions/setup-gcloud@v1 + + - name: Upload Diagrams + run: | + # '-J' options is to set Content-Encoding to gzip + gsutil -m rsync -J -R -d gen/diagrams gs://docs-cmp-files/diagrams diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..944c184a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +gen +.vscode + diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..5748d23e --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +# Generation Settings +GENERATED_DIR = gen +MODULLE_DIR = proto/cmp +PROTOC = protoc + +# Protodot diagrams +PROTODOT = protodot +PROTODOT_DIR = diagrams + +# Colors +GREEN=\033[92m +BLUE=\033[94m +RESET=\033[0m + +# Default target +all: diagrams + +# Generate protodot diagrams +diagrams: ${GENERATED_DIR}/${PROTODOT_DIR} + @echo "${GREEN}Generating Protodot Diagrams files${RESET}" + ./scripts/generate_protodot.sh ${GENERATED_DIR} ${MODULLE_DIR} ${PROTODOT_DIR} + +# Create necessary directories if they do not exist +${GENERATED_DIR}/${PROTODOT_DIR}: + mkdir -p $@ + +clean: + rm -rfv ${GENERATED_DIR}/* + +sabledocs: + protoc proto/cmp/*/*.proto -o descriptor.pb --include_source_info + sabledocs + mv sabledocs_output ${GENERATED_DIR}/ + rm -fv descriptor.pb + +# Mark commands as phony so make knows they're not associated with files +.PHONY: all clean diagrams sabledocs diff --git a/buf.gen.yaml b/buf.gen.yaml index 749e0c9e..46d05fc6 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -12,3 +12,5 @@ plugins: opt: paths=source_relative - plugin: buf.build/community/danielgtaylor-betterproto:v1.2.5 out: gen/python + - plugin: buf.build/protocolbuffers/python:v25.1 + out: gen/pbpy diff --git a/proto/buf.md b/proto/buf.md index 184bdc55..1c7007ab 100644 --- a/proto/buf.md +++ b/proto/buf.md @@ -7,137 +7,8 @@ --- -Welcome to the official documentation for Camino Message Types. The protocol suite is meticulously crafted to cater to a broad range of functionalities associated with the digital travel landscape. - The Camino Messenger protocol is created together with Partners from each vertical (flights, hotels, holiday homes, transfers, car rental, cruise,..). The objective is to create a message standard for the Camino Messenger, that is considered simple, efficient, complete, robust and easy to integrate by all partners. And conclusively it will delightfully be implemented and used by partners. As all other Camino Network components, the Camino Messenger Protocol is open source. Free to be used anywhere, but of course targeted to be used with the Camino Messenger. Please do not hesitate to communicate your observations on this documentation like uncertainties, mistakes or missing explanations, so that we can continuously improve this documentation. Every Camino Network Partner (Validator) can also participate in official Message Type reviews to help improve the message format. -## Index table - -- [Camino Messenger Protocol Documentation](#camino-messenger-protocol-documentation) - - [Message Type Standard](#message-type-standard) - - [Workflow](#workflow) - - [Fields](#fields) - - [Values](#values) - - [Validations](#validations) - - [Semantic Versioning:](#semantic-versioning) - - [Why Protobuf:](#why-protobuf) - - [Main Message Types](#main-message-types) - - [Nested Messages](#nested-messages) - -## Message Type Standard - -In the WhatsApp messenger, you'll find a couple of standardize message types you can exchange with anybody that has the WhatsApp client installed (text, location, audio, video, contact, document,..). The same for the Camino Messenger, all partners need to be able to uniformly use the flight, hotel, car rental, transfer, activities,.. Message Types, no matter to which partner they are connected. -The use of a Messenger client also allows to define the Message Type Standard beyond field names. There can be enhanced message validation, field data and workflow standardization. - -### Workflow - -A blockchain is product or service agnostic. Conclusively our strategy is to keep the workflow for the Camino Messenger the same for any product or service as well. - -Just like any API end-point from the web2 era, you can check the availability of a provider on the Camino network with a Ping Request - -Partner configuration can be managed via the Camino Partner Configurator, which will form part of the Camino Application Suite. Two messages have been made available to enable automatic detection of changed partners and fees: - -1. Partner Request gives you all active Camino Network Partners that are buying or selling their products and services. -2. The Network Fee Request gives you the cost of a Message to the Camino Network for operating the Camino Messenger and also the cost of specific messages towards specified providers. - Because this information is stored on the blockchain, the changes since a certain date/time can be requested using a blockheight parameter. - -Any product or service that can be traded on the Camino Network requires an onboarding process to understands which routes and airplanes an airline of flight provider offers. Or which hotels an accommodation provider and which activities a an excursion provider offers. For this onboarding and mapping process we have designed: - -1. ProductList Request: a Message Type to discover the products or services a provider is offering with some basic information to decide to distribute the product or service or not and to map it to internal codes. -2. ProductDetails Request: download all the information related to the product or service being offered. - -All products and services that can be traded on the Camino Network follow a 3 step approach for the booking process: - -1. Search: The first step is that a distribution partner submits a Search Request with a search_id to one or more supply partners. They return a Search Response that includes a search_option_id for each option. -2. Check: to verify whether a search option is still available at the same price after dwelling, the Validate Request refers to the search_id and search_option_id to be booked. The Validate Response returns a validation_id, availability status and total price. -3. Book: The submits a Mint Request that refers to the validation_id. After generating the booking in the Inventory System of the supplier and receiving a supplier reference, the messenger client creates a digital asset on the Camino blockchain and returns a digital_asset_id to the messenger client of the distributor. Which then initiates the transfer of funds to the seller and the digital asset to the buyer in one transaction. - -![workflow diagram] (workflow.jpg) - -After an initial booking is made, a number of events can happen in its lifecycle to full delivery of the service or product: - -1. To facilitate the "ghost booking process" and to check whether the distribution system and inventory system of a supplier have a matching booking status, the RetrieveBooking Request has been designed. For the time being it is not enough to rely on the single point of truth in the blockchain, because we want to provide an easy troubleshooting solution for suppliers to discover mismatches between their inventory system and the blockchain, but also for distributors to gain confidence in the consistency of systems. There is a BookingList and a BookingDetails variant. -2. The CancellationRequest is the standard procedure to cancel a product or service. As usual it includes a CancellationCheck Request to verify if cancellation is possible and what the cancellation cost would be. -3. After an initial product, service or package has been sold, an optional extra or service might be added to a product or a service. This is what we refer to as "upselling" in the industry. At the Camino Network we have designed a Message Type that can be sent to each provider that "owns" the booking for a specific product or service, so that any possible "upgrades" or additions can be offered. The AdditionalServices Request requires the distributor or provider reference to identify the booking. In the Response any optional or alternative product or service may be offered. -4. The BookingModification Request allows for an already confirmed booking to be modified to alternative products or additional services or different dates, if they have previously been offered in a Search Request or Upselling Request. - -Finally there is an extensive section of error messages so that adequate follow-up can be designed in the workflow for when something goes wrong. But also to make extensive partner performance visible and troubleshooting of under performing flows easily possible. - -### Fields - -Each field has a unique numeric identifier (field number) and a specific data type, which can range from scalars like integers, floating-point numbers, booleans, and strings, as well as more complex types such as nested messages and enumerations. These fields are defined in a .proto file, which serves as a contract between communicating parties, specifying the structure of the data they exchange. - -The field number serves as an identifier in the binary representation of the message, allowing for efficient encoding and decoding. In proto3 all fields are optional, and there are no built-in mechanisms for specifying required values. In proto3, the absence of a field is unset and return the default value. It will not be serialized to the wire. This means that distinguishing between an explicitly set default value and an unset field may require additional considerations in the application logic. Adding new fields in proto3 does not break backward compatibility with existing code. Unknown fields are ignored during deserialization, enabling systems to gracefully handle messages with additional fields. - -The Protobuf message definition specifies fields (name/value pairs), one for each piece of data that you want to include in this type of message. Each field has a name and a type. Primitive or Scalar types are most frequently used and there is a corresponding type definition in the [proto 3 language guide](https://protobuf.dev/programming-guides/proto3/). There is also an extensive variation of field definitions known as ["Well-Known Types"](https://protobuf.dev/reference/protobuf/google.protobuf/). - -### Values - -The values assigned to fields are serialized into a binary format, making it efficient for data transmission and storage. The binary representation is compact, reducing both bandwidth and storage requirements compared to more verbose formats like JSON. Additionally, protobuf values are strongly typed, providing a level of data integrity and reducing the likelihood of errors during serialization and deserialization processes. - -### Validations - -Proto3 intentionally omits certain features to maintain simplicity and ease of use. Proto3 primarily relies on language-specific validation mechanisms rather than embedding extensive validation rules within the protobuf specification itself. - -Adding additional validation logic in our application code or parsers can help ensure the integrity of the data being exchanged and can assist in catching discrepancies between different implementations/systems. We can consider validation rules for data format and constraints, also to prevent malicious or unintentional injection of incorrect or harmful data. Validations can catch errors early in the development process, which can help speed up implementation. - -## Semantic Versioning - -Feedback and reviews will lead to a fully backward compatible minor version of the Message Type (i.e. from version 1.0.0 to version 1.1.0). Bugfixes and non functional improvements lead to a patch level version in the third number. A major version signifies a substantial new version, API changes or modifications that break backwards compatibility. Only the latest version will be included in the Camino Messenger Client, except for major versions, the latest previous version will remain available for a very limited time to allow all Camino network Partners to upgrade to the new version. - -## Why Protobuf - -Protobuf's compact binary serialization format results in smaller message sizes compared to human-readable formats like JSON, making it efficient for data transmission and storage in performance-critical applications. This is particularly beneficial in our search messages where network efficiency is a priority and where the data payload is large due to the many products and services offered in search responses. Protobuf offers a better performance than JSON in terms of serialization and deserialization speed where Protobuf's native libraries are used. Protobuf schemas are strongly typed, which leads to more robust code. Protobuf provides built-in support for evolving data structure over time while maintaining backward and forward compatibility. Protobuf is language-agnostic. Nested messages in Protobuf are a powerful feature that allow definition of a message type within another message type. This is akin to declaring a class within another class in object-oriented programming languages. There is an extensive variation of field definitions known as "Well-Known Types". There is a vast amount of documentation and examples in [protobuf documentation](https://protobuf.dev/) - -In the gRPC metadata you can specify your messageID, from and to wallet addresses, so that the payload remains untouched and encrypted from P2P. You'll also find latency and processing time stamps of the different hops in the metadata, which gives you transparency and helps with troubleshooting. - -The `tcm` directory represents the core of our protocol definitions, under which you will find Main Message Types and Nested Messages. - -## Main Message Types - -This subset offers high-level communication utilities and interaction schemas for all products and services that can be traded on the Camino Network. -For each vertical you will find a specific search request and response. The purchase workflow is stateful, meaning that the search results are numbered with search_option_ids that can be checked using the validate request and response. Once validated, a product or service can be booked through the mint request and response with a validation_id. - -For most of the products and services there will also be downloadable static data messages in the form of "descriptive info" or policies. These work always with a list functionality with a "last update date/time stamp" and a "get details" function for each item in the list. - -See above details in Message Type Standard for more generic details or at the introduction of each Message Type, where we go into more detail of this specific message. - -- **ping.proto**: A simple utility message type, essential for health checks and service availability confirmations. -- **partners.proto**: discovery of all partners trading on the Camino Network -- **network_fee.proto**: Contains specifications related to network transaction fees. -- **product_list.proto**: List of products or services available from a provider -- **product_details.proto**: Description of products or services available from a provider -- **accommodation.proto**: -- **holiday_home.proto**: Defines the data structure and associated parameters for holiday homes. -- **flight.proto**: -- **activity.proto**: for Tickets & Excursions -- **rail.proto**: Rail (not started) -- **cruise.proto**: Cruise (not started) -- **car_rental.proto**: Rent a car -- **transfer.proto**: Transfer -- **insurance.proto**: Insurances (not started) -- **camping.proto**: Camping (not started) -- **package.proto**: Packages, inherent format consisting of the above structures for the services/products included in the package -- **flight_status.proto**: Flight status information -- **entry_destination.proto**: Entry requirements & Destination information - -## Nested Messages - Data Types - -Delving deeper into the data structures and components, protobuf uses shared structures as nested messages, which we call **"types"**. For example the traveller details in traveller.proto. The transformation to your native logic only requires a one-time development for all main Message Types that will be implemented. Nested messages provide a clear, hierarchical structure, making it easier to understand, review and discuss improvements to the Message standard with the Camino Network Partners. Other benefits of the nested structure of Protobuf are the encapsulation leading to cleaner and easier maintainable code and type safety which helps catching errors early in the integration process. - -Some examples: - -- **coordinate.proto**: Captures geographical coordinates. -- **currency.proto**: Handles different currency types and associated attributes. -- **date.proto**: A flexible schema for managing date-related data. -- **distance.proto**: Quantifies and categorizes distances, catering to various units and interpretations. -- **filter.proto**: Offers dynamic and static filtering capabilities. -- **geo_location.proto**: A comprehensive protocol that merges various geographical parameters. -- **holiday_home.proto**: Details about individual holiday homes, including amenities, location, and more. -- **tcm_message.proto**: The message structure, integrating meta information and inter-message references. -- **traveller.proto**: Profiles, preferences, and details of travellers. -- **travel_period.proto**: Specifies the time frame for travel plans, vacations, or any related temporal span. - -Whether you are integrating the Camino Message Types into your platform, extending its capabilities, or simply learning more about our approach to digital travel solutions, this documentation aims to be your comprehensive guide. We encourage developers and enthusiasts alike to explore and contribute, ensuring that the Camino Message Types remains at the forefront of innovation. +For more information about the concept please visit: https://playground.docs.camino.network/camino-messenger diff --git a/proto/cmp/services/accommodation/v1alpha1/list.proto b/proto/cmp/services/accommodation/v1alpha1/list.proto new file mode 100644 index 00000000..d5a9c958 --- /dev/null +++ b/proto/cmp/services/accommodation/v1alpha1/list.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; + +package cmp.services.accommodation.v1alpha1; + +import "cmp/services/accommodation/v1alpha1/property_types.proto"; +import "cmp/types/v1alpha1/common.proto"; +import "google/protobuf/timestamp.proto"; + +message AccommodationProductListRequest { + // 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; +} + +message AccommodationProductListResponse { + // Message header + cmp.types.v1alpha1.Header header = 1; + + // Product list: Properties + repeated Property properties = 2; +} + +// ### Accommodation Product List Service +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/list.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/list.proto.dot.svg) +service AccommodationProductListService { + // Returns product list for accommodation (properties) + rpc AccommodationProductList(AccommodationProductListRequest) returns (AccommodationProductListResponse); +} diff --git a/proto/cmp/services/accommodation/v1alpha1/property_types.proto b/proto/cmp/services/accommodation/v1alpha1/property_types.proto new file mode 100644 index 00000000..755838f5 --- /dev/null +++ b/proto/cmp/services/accommodation/v1alpha1/property_types.proto @@ -0,0 +1,94 @@ +syntax = "proto3"; + +package cmp.services.accommodation.v1alpha1; + +import "cmp/types/v1alpha1/address.proto"; +import "cmp/types/v1alpha1/email.proto"; +import "cmp/types/v1alpha1/location.proto"; +import "cmp/types/v1alpha1/phone.proto"; +import "google/protobuf/timestamp.proto"; + +// ### Property message type +// +// Represents property info for an accommodation product +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/property_types.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/property_types.proto.dot.svg) +message Property { + // Ex: "2023-08-28T12:03:50", + google.protobuf.Timestamp last_modified = 1; + + // Ex: "AESPMI1234" + string property_code = 2; + + // Ex: "Beach Hotel Alanya" + string name = 3; + + // Ex: "Hilton" + string chain = 4; + + // Ex: CategoryRating.CATEGORY_RATING_4_5 + CategoryRating category_rating = 5; + + // Ex: CategoryUnit.CATEGORY_UNIT_PALMS + CategoryUnit category_unit = 6; + + // Ex: Address type + cmp.types.v1alpha1.Address address = 7; + + // Emails + repeated cmp.types.v1alpha1.Email emails = 8; + + // Phones + repeated cmp.types.v1alpha1.Phone phones = 9; + + // Location coordinate + cmp.types.v1alpha1.Coordinate coordinate = 10; + + // Ex: "www.hotel.com" + string website = 11; + + // Status of the property + // FIXME: Changed "deactivated" to "status". But we should still make this an enum. ?? + string status = 12; + + // GIATA ID + string giata_id = 13; + + // Goal ID + int32 goal_id = 14; + + // Airports + // Ex: ["PMI", "ZRH", "AYT"] + repeated string airports = 15; +} + +enum CategoryRating { + CATEGORY_RATING_UNSPECIFIED = 0; + CATEGORY_RATING_0_5 = 1; + CATEGORY_RATING_1_0 = 2; + CATEGORY_RATING_1_5 = 3; + CATEGORY_RATING_2_0 = 4; + CATEGORY_RATING_2_5 = 5; + CATEGORY_RATING_3_0 = 6; + CATEGORY_RATING_3_5 = 7; + CATEGORY_RATING_4_0 = 8; + CATEGORY_RATING_4_5 = 9; + CATEGORY_RATING_5_0 = 10; + CATEGORY_RATING_5_5 = 11; + CATEGORY_RATING_6_0 = 12; + CATEGORY_RATING_6_5 = 13; + CATEGORY_RATING_7_0 = 14; + CATEGORY_RATING_7_5 = 15; + CATEGORY_RATING_8_0 = 16; + CATEGORY_RATING_8_5 = 17; + CATEGORY_RATING_9_0 = 18; + CATEGORY_RATING_9_5 = 19; + CATEGORY_RATING_10_0 = 20; +} + +enum CategoryUnit { + CATEGORY_UNIT_UNSPECIFIED = 0; + CATEGORY_UNIT_STARS = 1; + CATEGORY_UNIT_PALMS = 2; +} diff --git a/proto/cmp/services/accommodation/v1alpha1/search.proto b/proto/cmp/services/accommodation/v1alpha1/search.proto new file mode 100644 index 00000000..56fdc5ae --- /dev/null +++ b/proto/cmp/services/accommodation/v1alpha1/search.proto @@ -0,0 +1,91 @@ +syntax = "proto3"; + +// ## Accommodation Services +// +// The Accommodation services are used for both hotels and holiday homes, often +// called short term rentals. +// +// Any search message response in the Camino Messenger Protocol only includes +// dynamic data. Static data can be cached and kept up to data with the Product List +// and Product Details messages. +// +// 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_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, so that several rooms or houses can be requested for the +// same dates and location or for the purpose of a tour or roadtrip, several +// accommodations for sequential dates and different locations. +// +// Developers leveraging this message type should ensure proper validation and +// handling, especially considering fields that are still under review, like +// `speech_request`. +message AccommodationSearchRequest { + // Message header. Contains API version, message info string and end-user wallet + // address + cmp.types.v1alpha1.Header header = 1; + + // Search request metadata + cmp.types.v1alpha1.SearchRequestMetadata metadata = 2; + + // Generic search parameters Ex: Inclusion of OnRequest options and inclusion of + // 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; +} + +// ### Accommodation Search Response +// +// The `Accommodation Search Response` message type facilitates the response for +// accommodations like hotel and holiday home searches within the platform. +// +// In the response a search_id must be included and a search_option_id for every +// bookable option responded. Included, compulsary and optional services can be +// included. A simple "free cancellation upto" can be set or full cancellation +// pilicies can be included. +message AccommodationSearchResponse { + // Message header. Contains API version, message info string and end user wallet + // address. + cmp.types.v1alpha1.Header header = 1; + + // Search response metadata + cmp.types.v1alpha1.SearchResponseMetadata metadata = 2; + + // Unique combinations of bookable search results, like property, + repeated AccommodationSearchResult results = 3; +} + +// ### Accommodation Search Service definition +// +// ![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) +service AccommodationSearchService { + // Accommodation Search method + rpc AccommodationSearch(AccommodationSearchRequest) returns (AccommodationSearchResponse); +} diff --git a/proto/cmp/services/accommodation/v1alpha1/search_parameters_types.proto b/proto/cmp/services/accommodation/v1alpha1/search_parameters_types.proto new file mode 100644 index 00000000..889963d2 --- /dev/null +++ b/proto/cmp/services/accommodation/v1alpha1/search_parameters_types.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; + +package cmp.services.accommodation.v1alpha1; + +import "cmp/types/v1alpha1/location.proto"; +import "cmp/types/v1alpha1/meal_plan.proto"; +import "cmp/types/v1alpha1/rate.proto"; + +// ### Activity Search Parameters +// +// ![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) +message AccommodationSearchParameters { + // Geo Location for search, set only one of the fields at once. + // + // This "one of" field enforces only one of the fields below. They all share + // memory, setting one will remove the others. + oneof geo_location { + // FIXME: Do we need a list of location code here? Other fields are not lists. + cmp.types.v1alpha1.LocationCodes location_codes = 1; + + // Single geographic point represented by two double fields. + cmp.types.v1alpha1.Coordinate location_coordinate = 2; + + // Geo tree type, representted by Country, Region, and City_or_Resort. + cmp.types.v1alpha1.GeoTree location_geo_tree = 3; + + // Geo circle. Represented by a coordinate and a distance for radius + cmp.types.v1alpha1.GeoCircle location_geo_circle = 4; + + // Geo polygon. Represented by a list of coordinate points. + cmp.types.v1alpha1.GeoPolygon location_geo_polygon = 5; + } + + // Mealplan codes + repeated cmp.types.v1alpha1.MealPlan meal_plan_codes = 6; + + // Rate plans + repeated cmp.types.v1alpha1.RatePlan rate_plan = 7; + + // Rate Rules + // FIXME: Did we decided to remove this from SearchParameters? + // FIXME: Maybe some users/distributors would want to search for only + // FIXME: RESELLABLE offers? + repeated cmp.types.v1alpha1.RateRule rate_rules = 8; +} diff --git a/proto/cmp/services/accommodation/v1alpha1/search_result_types.proto b/proto/cmp/services/accommodation/v1alpha1/search_result_types.proto new file mode 100644 index 00000000..9faf1c14 --- /dev/null +++ b/proto/cmp/services/accommodation/v1alpha1/search_result_types.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package cmp.services.accommodation.v1alpha1; + +import "cmp/services/accommodation/v1alpha1/unit_types.proto"; +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. +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/search_result_types.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/search_result_types.proto.dot.svg) +message AccommodationSearchResult { + // ID for the search result. This is an increasing number starting at 0 and + // increasing by 1 for every search result. + int32 result_id = 1; + + // Units for this search result + repeated Unit units = 2; + + // ## Total price in detail, with breakdowns + cmp.types.v1alpha1.PriceDetail total_price_detail = 3; + + // The RateRule specifies whether a search result is non-refundable or not + repeated cmp.types.v1alpha1.RateRule rate_rules = 4; + + // The cancellation conditions related to an option + cmp.types.v1alpha1.CancelPolicy cancel_policy = 5; + + // Freetext remarks without any functionality + string remarks = 6; +} diff --git a/proto/cmp/services/accommodation/v1alpha1/unit_types.proto b/proto/cmp/services/accommodation/v1alpha1/unit_types.proto new file mode 100644 index 00000000..de222de8 --- /dev/null +++ b/proto/cmp/services/accommodation/v1alpha1/unit_types.proto @@ -0,0 +1,93 @@ +syntax = "proto3"; + +package cmp.services.accommodation.v1alpha1; + +import "cmp/types/v1alpha1/cancel_policy.proto"; +import "cmp/types/v1alpha1/meal_plan.proto"; +import "cmp/types/v1alpha1/price.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. +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/unit_types.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/unit_types.proto.dot.svg) +message Unit { + // Unit Type. Used to distinguish between hotel rooms and holiday homes. + // Ex: `UnitType.UNIT_TYPE_ROOM` + UnitType type = 1; + + // Unit code. Room code of the unit in case of hotel. Ex: "RMSDDB0000" + string unit_code = 2; + + // Unit name. In case of enrichment additional name of the unit code. + // Ex: "Double Standard Room" + string unit_name = 3; + + // Travel period + cmp.types.v1alpha1.TravelPeriod travel_period = 4; + + // Travellers + repeated cmp.types.v1alpha1.Traveller travellers = 5; + + // Beds + repeated Bed beds = 6; + + // Price in detail with breakdowns etc + 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; + + // Mealplan code + cmp.types.v1alpha1.MealPlan meal_plan_code = 11; + + // Rate plan + cmp.types.v1alpha1.RatePlan rate_plan = 12; + + // Rate Rule + cmp.types.v1alpha1.RateRule rate_rule = 13; + + // Cancel Policies + // 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; + + // 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; + UNIT_TYPE_HOLIDAY_HOME = 2; +} diff --git a/proto/cmp/services/activity/v1alpha1/search.proto b/proto/cmp/services/activity/v1alpha1/search.proto new file mode 100644 index 00000000..82f5e2f6 --- /dev/null +++ b/proto/cmp/services/activity/v1alpha1/search.proto @@ -0,0 +1,123 @@ +syntax = "proto3"; + +// ### Activity Services +// +// The Activity services are used for both tickets and excursions +// +// Any search message response in the Camino Messenger Protocol only includes +// dynamic data. Static data can be cached and kept up to data with the Product List +// and Product Details messages. +// +// This package is a **WIP**. +package cmp.services.activity.v1alpha1; + +import "cmp/services/activity/v1alpha1/search_parameters_types.proto"; +import "cmp/services/activity/v1alpha1/search_result_types.proto"; +import "cmp/types/v1alpha1/common.proto"; +import "cmp/types/v1alpha1/location.proto"; +import "cmp/types/v1alpha1/search.proto"; +import "cmp/types/v1alpha1/travel_period.proto"; +import "cmp/types/v1alpha1/traveller.proto"; + +// ### Activity Search Request +// +// Search request for Activities +message ActivitySearchRequest { + // Message header. Contains API version, message info string and end-user wallet + // address + cmp.types.v1alpha1.Header header = 1; + + // Search request metadata + cmp.types.v1alpha1.SearchRequestMetadata metadata = 2; + + // Generic search parameters + // + // Ex: Inclusion of OnRequest options and inclusion of only the cheapest or all + // options. + cmp.types.v1alpha1.SearchParameters search_parameters_generic = 3; + + // Activiy specific search parameters + // Ex: ?? + ActivitySearchParameters search_parameters_activity = 4; + + // Travel period + cmp.types.v1alpha1.TravelPeriod travel_period = 5; + + // Travellers + repeated cmp.types.v1alpha1.Traveller travellers = 6; + + // ### Source Location + // + // For search, set only one of the fields at once. Source location indicates the + // customer’s position at the start of the service. Typical value would be the + // stay hotel or the touristic destination. The source location is needed for + // service and transfer availability, pickup location and pickup time calculation. + // + // This one of field enforces only one of the fields below. They all share memory, + // setting one will remove the others. + oneof source_location { + // The code and code type of a stay location the provider will be able to process + // Ex. GiataID + cmp.types.v1alpha1.LocationCodes source_location_codes = 7; + + // Single geographic point represented by two double fields. + cmp.types.v1alpha1.Coordinate source_location_coordinate = 8; + + // Geo tree type, representted by Country, Region, and City_or_Resort. + cmp.types.v1alpha1.GeoTree source_location_geo_tree = 9; + + // Geo circle. Represented by a coordinate and a distance for radius + cmp.types.v1alpha1.GeoCircle source_location_geo_circle = 10; + + // Geo polygon. Represented by a list of coordinate points. + cmp.types.v1alpha1.GeoPolygon source_location_geo_polygon = 11; + } + + // ### Service Location + // + // For search, set only one of the field at once. Service location specifies the + // areas involved in aticket or excursion service. Service location indicates the + // area of the requested services. Typical value would be the region or resort. + // + // This one of field enforces only one of the fields below. They all share memory, + // setting one will remove the others. + oneof service_location { + // The code and code type of a stay location the distributor will be able to process + // Ex. Google Place ID, Foursquare fsq_id, OpenStreetMap Ref, Here ID or any other agreed code type. + cmp.types.v1alpha1.LocationCodes service_location_codes = 12; + + // Single geographic point represented by two double fields. + cmp.types.v1alpha1.Coordinate service_location_coordinate = 13; + + // Geo tree type, representted by Country, Region, and City_or_Resort. + cmp.types.v1alpha1.GeoTree service_location_geo_tree = 14; + + // Geo circle. Represented by a coordinate and a distance for radius + cmp.types.v1alpha1.GeoCircle service_location_geo_circle = 15; + + // Geo polygon. Represented by a list of coordinate points. + cmp.types.v1alpha1.GeoPolygon service_location_geo_polygon = 16; + } +} + +message ActivitySearchResponse { + // Message header. Contains API version, message info string and end user wallet + // address. + cmp.types.v1alpha1.Header header = 1; + + // Search response metadata + cmp.types.v1alpha1.SearchResponseMetadata metadata = 2; + + // Unique combinations of bookable search results + repeated ActivitySearchResult results = 3; +} + +// ### Activity Search Service +// +// Takes `ActivitySearchRequest` message type and returns `ActivitySearchResponse` message type. +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/activity/v1alpha1/search.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/activity/v1alpha1/search.proto.dot.svg) +service ActivitySearchService { + rpc ActivitySearch(ActivitySearchRequest) returns (ActivitySearchResponse); +} diff --git a/proto/cmp/services/activity/v1alpha1/search_parameters_types.proto b/proto/cmp/services/activity/v1alpha1/search_parameters_types.proto new file mode 100644 index 00000000..ff8b17a3 --- /dev/null +++ b/proto/cmp/services/activity/v1alpha1/search_parameters_types.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package cmp.services.activity.v1alpha1; + +// ### Activity Search Parameters +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/activity/v1alpha1/search_parameters_types.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/activity/v1alpha1/search_parameters_types.proto.dot.svg) +message ActivitySearchParameters {} diff --git a/proto/cmp/services/activity/v1alpha1/search_result_types.proto b/proto/cmp/services/activity/v1alpha1/search_result_types.proto new file mode 100644 index 00000000..1d1d0cd4 --- /dev/null +++ b/proto/cmp/services/activity/v1alpha1/search_result_types.proto @@ -0,0 +1,116 @@ +syntax = "proto3"; + +package cmp.services.activity.v1alpha1; + +import "cmp/types/v1alpha1/address.proto"; +import "cmp/types/v1alpha1/datetime_range.proto"; +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. +// ![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 { + // Option ID for the search option. This is an increasing number starting at 0 and + // increasing by 1 for every search result. + int32 result_id = 1; + + // Activity basic info + ActivityInfo info = 2; + + // Schedule + cmp.types.v1alpha1.DateTimeRange schedule = 3; + + // Activity location + ActivityLocation location = 4; + + // Pickup Dropoff + repeated PickupDropoffEvent pickup_dropoff_events = 5; + + // Min participants + int32 min_participants = 6; + + // Max participants + int32 max_participants = 7; + + // Price with value and currency code + cmp.types.v1alpha1.Price price = 8; + + // Pricing type + // Ex: "PerPerson", "PerGroup" + PricingType pricing_type = 9; +} + +// ### Activity Info +// +// FIXME: We need optimizations in this type +message ActivityInfo { + // Ex: "TC000000" + string product_code = 1; + + // Ex: "Helicopter Tour Heli" + string product_name = 2; + + // Ex: "EESPMI46VY" + string activity_id = 3; + + // Ex: "Tour (40 min)" + string activity_name = 4; + + // Ex: "XO" + string service_code = 5; + + // Ex: "with transfer from/to hotel" + string service_name = 6; + + // Ex: "XA" + string category_code = 7; + + // Ex: "Excursions & Activities" + string category_name = 8; + + // Ex: "SF" + string type_code = 9; + + // Ex: "Safari" + string type_name = 10; +} + +// ### Activity Location +message ActivityLocation { + // Ex: Ctra. de la Porrassa, s/n, Magaluf, ES 07181 in structured fields + cmp.types.v1alpha1.Address address = 1; + + // Geo Tree. Country, region, city_or_resort + cmp.types.v1alpha1.GeoTree geo_tree = 2; + + // Coordinate + cmp.types.v1alpha1.Coordinate coordinate = 3; +} + +// ### PickupDropoffEvent +message PickupDropoffEvent { + // Ex: "AESPMI43NU", + string location_code = 1; + // Ex: "Sunny Beach Hotel", + string location_name = 2; + + // Ex: "true", + bool pickup_ind = 3; + + // Ex: "OTHERS / Parking Varadero(bus stop css nº50)", + string other_info = 4; + + // Ex: "2023-07-15T09:05:00" + google.protobuf.Timestamp date_time = 5; +} + +enum PricingType { + PRICING_TYPE_UNSPECIFIED = 0; + PRICING_TYPE_PERPERSON = 1; + PRICING_TYPE_PERGROUP = 2; +} diff --git a/proto/cmp/services/flight/v1alpha1/datatypes.proto b/proto/cmp/services/flight/v1alpha1/datatypes.proto deleted file mode 100644 index c0005e97..00000000 --- a/proto/cmp/services/flight/v1alpha1/datatypes.proto +++ /dev/null @@ -1,89 +0,0 @@ -syntax = "proto3"; - -package cmp.services.flight.v1alpha1; - -import "cmp/types/v1alpha1/cancel_policy.proto"; -import "cmp/types/v1alpha1/date.proto"; -import "cmp/types/v1alpha1/price.proto"; - -// Search Option -// -// This is for basic property search response's search options -message FlightSearchOption { - string id = 1; - string offer_id = 2; - repeated FlightSegment segments = 3; - cmp.types.v1alpha1.Price price = 4; - repeated AnciliaryService anciliary_services = 5; - Validity validity = 6; - cmp.types.v1alpha1.CancelPolicy cancel_policy = 7; -} - -message FlightSegment { - string segment_id = 1; - string airline = 2; - FlightSchedule departure = 3; - FlightSchedule arrival = 4; - string class_of_service_description = 5; - string class_of_service_code = 6; - cmp.types.v1alpha1.Price price = 7; -} - -message FlightSchedule { - string date = 1; - string airport = 2; -} - -message AnciliaryService { - string service_id = 1; - string name = 2; - cmp.types.v1alpha1.Price price = 3; -} - -message Validity { - string start = 1; - string end = 2; -} - -message FlightSearchCriteria { - cmp.types.v1alpha1.Date departure_date = 1; - string departure = 2; - string arrival = 3; - string min_time = 4; - string max_time = 5; -} - -message FlightOfferCriteria { - CabinCriteria cabin_criteria = 1; - ServiceCriteria service_criteria = 2; -} - -message CabinCriteria { - CabinType cabin_type = 1; - repeated SeatCriteria seat_criteria = 2; - int32 row_number = 3; -} - -message CabinType { - string class_of_service_code = 1; - string class_of_service_description = 2; -} - -message SeatCriteria { - repeated SeatType seat_type = 1; -} - -message SeatType { - string code = 1; - string description = 2; -} - -message ServiceCriteria { - bool meal = 1; - ServiceSpecialNeed special_needs = 2; -} - -message ServiceSpecialNeed { - string code = 1; - string description = 2; -} diff --git a/proto/cmp/services/flight/v1alpha1/search.proto b/proto/cmp/services/flight/v1alpha1/search.proto deleted file mode 100644 index ef8d3762..00000000 --- a/proto/cmp/services/flight/v1alpha1/search.proto +++ /dev/null @@ -1,69 +0,0 @@ -syntax = "proto3"; - -package cmp.services.flight.v1alpha1; - -import "cmp/services/flight/v1alpha1/datatypes.proto"; -import "cmp/types/v1alpha1/common.proto"; -import "cmp/types/v1alpha1/traveller.proto"; - -/* - # Flight Search Request Message - - ## Description - - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, diam - vitae aliquam tincidunt, nunc nisl ultricies nunc, quis aliquam nisl nisl - velit. Nulla facilisi. Nulla facilisi. Nulla facilisi. Nulla facilisi. - - ## Diagram - - ![FlightSearch](http://34.36.20.191/tcm/static/diagrams/messages/flight_search.proto.dot.svg) - -*/ -message FlightSearchRequest { - // Message Header - // Contains api version, message info string, sender & receiver wallet - // addresses - cmp.types.v1alpha1.Header header = 1; - - string external_session_id = 2; - string enrichment = 3; - string currency = 4; - string language = 5; - string market = 6; - string include_on_request = 7; - string include_combinations = 8; - - repeated cmp.types.v1alpha1.Traveller passengers = 9; - repeated cmp.services.flight.v1alpha1.FlightSearchCriteria flight_search_criterias = 10; - repeated cmp.services.flight.v1alpha1.FlightOfferCriteria flight_offer_criterias = 11; -} - -/* - # Flight Search Response Message - - ## Description - - Vitae aliquam tincidunt, nunc nisl ultricies nunc, quis aliquam nisl nisl - velit. Nulla facilisi. Nulla facilisi. Nulla facilisi. Nulla facilisi. - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, diam - - ## Diagram - - ![FlightSearch](http://34.36.20.191/tcm/static/diagrams/messages/flight_search.proto.dot.svg) - -*/ -message FlightSearchResponse { - // Message Header - // Contains api version, message info string, sender & receiver wallet - // addresses - cmp.types.v1alpha1.Header header = 1; - - string context = 2; - string errors = 3; - string warnings = 4; - string supplier_code = 5; - string external_session_id = 6; - string search_id = 7; - repeated cmp.services.flight.v1alpha1.FlightSearchOption options = 8; -} diff --git a/proto/cmp/services/holiday_home/v1alpha1/holiday_home_types.proto b/proto/cmp/services/holiday_home/v1alpha1/holiday_home_types.proto deleted file mode 100644 index 30860f93..00000000 --- a/proto/cmp/services/holiday_home/v1alpha1/holiday_home_types.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto3"; - -package cmp.services.holiday_home.v1alpha1; - -import "cmp/types/v1alpha1/filter.proto"; -import "cmp/types/v1alpha1/geo_location.proto"; -import "cmp/types/v1alpha1/travel_period.proto"; -import "cmp/types/v1alpha1/traveller.proto"; - -// Holiday Home -message HolidayHome { - // Rate plan - string rate_plan = 1; - - // Free-text field to provide more detials for better offer personalization. This field can be provided in combination with a Geo location or as stand-alone. - string free_text = 2; - - // The speach request is provided as a link to a recording to process for better offer personalization. This field can be provided in combination with a Geo location or as stand-alone. - string speech_request = 3; - - // Geo Location - cmp.types.v1alpha1.GeoLocation geo_location = 4; - - // Various provider and product specific filters can be provided here in agreed name/value pairs - repeated cmp.types.v1alpha1.Filter filters = 5; - - // Travel period - cmp.types.v1alpha1.TravelPeriod travel_period = 6; - - // Travellers - repeated cmp.types.v1alpha1.Traveller travellers = 7; -} diff --git a/proto/cmp/services/holiday_home/v1alpha1/search.proto b/proto/cmp/services/holiday_home/v1alpha1/search.proto deleted file mode 100644 index 4d308af4..00000000 --- a/proto/cmp/services/holiday_home/v1alpha1/search.proto +++ /dev/null @@ -1,74 +0,0 @@ -syntax = "proto3"; - -package cmp.services.holiday_home.v1alpha1; - -import "cmp/services/holiday_home/v1alpha1/holiday_home_types.proto"; -import "cmp/types/v1alpha1/common.proto"; -import "cmp/types/v1alpha1/country.proto"; -import "cmp/types/v1alpha1/currency.proto"; -import "cmp/types/v1alpha1/enrichment.proto"; -import "cmp/types/v1alpha1/language.proto"; -import "cmp/types/v1alpha1/search_option.proto"; - -/* - ### HolidayHomeSearchRequest Message Type - - ![HolidayHomeSearchRequestDiagram](http://localhost:3000/img/holiday_home.proto.dot.svg) - - The `HolidayHomeSearchRequest` message type facilitates the request for holiday - home searches within the platform. This message type is derived from the `AccommodationSearchRequest` where the hotel specific concepts - like room and mealplan have been removed and holiday home specific concepts like deposit, extra laundry change, etc have been incorporated - - Developers leveraging this message type should ensure proper validation and - handling, especially considering fields that are still under review, like - `speech_request`. -*/ -message HolidayHomeSearchRequest { - // Message Header. Contains api version, message info string and end user wallet address - cmp.types.v1alpha1.Header header = 1; - - // An identifier for external sessions, aiding in tracking and continuity across sessions. - string external_session_id = 2; - - // Enables additional contextual information to be added to the search response. - // Possible values are none, full and thumbnail. If not set, the assumed default value is none. - cmp.types.v1alpha1.Enrichment enrichment = 3; - - // Requested currency according to ISO 4217 Currency codes - cmp.types.v1alpha1.Currency currency = 4; - - // Requested language according to ISO 639-1 Language codes - cmp.types.v1alpha1.Language language = 5; - - // Request generated for a specific market according to ISO 3166-1 Country codes - cmp.types.v1alpha1.Country country = 6; - - // Include OnRequest options in the response or only immediately bookable options - bool include_on_request = 7; - - // Only show the cheapest option for one product, or include all possible combinations - bool include_combinations = 8; - - // Homes - repeated cmp.services.holiday_home.v1alpha1.HolidayHome homes = 9; -} - -// Holiday Home Search Response -message HolidayHomeSearchResponse { - // Message Header. Contains api version, message info string and end user wallet address - cmp.types.v1alpha1.Header header = 1; - - string context = 2; - string errors = 3; - string warnings = 4; - string supplier_code = 5; - string external_session_id = 6; - string search_id = 7; - repeated cmp.types.v1alpha1.SearchOption options = 8; -} - -// The Holiday Home Service definition -service HolidayHomeSearchService { - // Holiday Home Search method - rpc HolidayHomeSearch(HolidayHomeSearchRequest) returns (HolidayHomeSearchResponse); -} diff --git a/proto/cmp/services/network/v1alpha1/fee.proto b/proto/cmp/services/network/v1alpha1/fee.proto new file mode 100644 index 00000000..e418cc3f --- /dev/null +++ b/proto/cmp/services/network/v1alpha1/fee.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; + +package cmp.services.network.v1alpha1; + +import "cmp/types/v1alpha1/asset.proto"; + +// ### Network Fee Message Type +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/network/v1alpha1/fee.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/network/v1alpha1/fee.proto.dot.svg) +message NetworkFee { + // Network fee, unit is nCAM + // 1 CAM == 1 000 000 000 nCAM + int32 amount = 1; + + // Asset of the fee + // + // FIXME: Not sure if we need this. For CAM it's a well known asset on the chain + // but maybe we'll need other assets also? + cmp.types.v1alpha1.Asset asset = 2; +} + +message GetNetworkFeeRequest { + // FIXME: Does this make sense here? + int32 block_height = 1; +} + +message GetNetworkFeeResponse { + NetworkFee network_fee = 1; + int32 current_block_height = 2; +} + +service GetNetworkFeeService { + rpc GetNetworkFee(GetNetworkFeeRequest) returns (GetNetworkFeeResponse); +} diff --git a/proto/cmp/services/partner/v1alpha1/partner_configuration.proto b/proto/cmp/services/partner/v1alpha1/partner_configuration.proto new file mode 100644 index 00000000..1f25c402 --- /dev/null +++ b/proto/cmp/services/partner/v1alpha1/partner_configuration.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; + +package cmp.services.partner.v1alpha1; + +import "cmp/types/v1alpha1/partner.proto"; + +// ### Partner Configuration message type +// +// This message type represents the partner configuration on T-Chain (not +// implemented yet) +message PartnerConfiguration { + // List of partners from the on-chain Partner Configuration + repeated cmp.types.v1alpha1.Partner partners = 1; +} + +message GetPartnerConfigurationRequest { + // Only respond with updated partners after this block height. + int32 block_height = 2; + + // Partner wallet addresses. Response is returned with only partners that have + // these addresses. + repeated string partner_addresses = 3; +} + +message GetPartnerConfigurationResponse { + // Partner configuration + PartnerConfiguration partner_configuration = 1; + + // Current block height. Distributors can keep this info for later reference. + int32 current_block_height = 2; +} + +// ### Get Partner Configuration Service +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/partner/v1alpha1/partner_configuration.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/partner/v1alpha1/partner_configuration.proto.dot.svg) +service GetPartnerConfigurationService { + // #### GetPartnerConfiguration + // + // Takes `GetPartnerConfigurationRequest` which contains optional block height and + // partner wallet addresses and returns `GetPartnerConfigurationResponse` which + // contains the current block height and the`PartnerConfiguration` for the given + // addresses (if any, returns all if none is provided) and only if the data is + // changed after the provided block height. + rpc GetPartnerConfiguration(GetPartnerConfigurationRequest) returns (GetPartnerConfigurationResponse); +} diff --git a/proto/cmp/services/ping/v1alpha1/ping.proto b/proto/cmp/services/ping/v1alpha1/ping.proto index d917fe7d..59ce8393 100644 --- a/proto/cmp/services/ping/v1alpha1/ping.proto +++ b/proto/cmp/services/ping/v1alpha1/ping.proto @@ -1,35 +1,40 @@ syntax = "proto3"; -/* - ## Ping Message -*/ +// ### Ping Message package cmp.services.ping.v1alpha1; import "cmp/types/v1alpha1/common.proto"; +import "google/protobuf/timestamp.proto"; -// FIXME: IMO, Ping requests and reponses should include a timestamp? +// The ping message is designed to test the availability of a provider service and +// to test the network latency as in the gRPC metadata information the DateTime is +// stored of each hop. message PingRequest { // Message Header - // Contains api version, message info string and end user wallet address cmp.types.v1alpha1.Header header = 1; // Ping message string ping_message = 2; + + // DateTime of the ping request + google.protobuf.Timestamp timestamp = 3; } -// FIXME: Ping request & reponse messages looks same, do we need two different -// messages? message PingResponse { // Message Header - // Contains api version, message info string, sender & receiver wallet - // addresses cmp.types.v1alpha1.Header header = 1; // Ping message string ping_message = 2; + + // DateTime of the ping response + google.protobuf.Timestamp timestamp = 3; } // The Ping Service definition +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/ping/v1alpha1/ping.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/ping/v1alpha1/ping.proto.dot.svg) service PingService { // Ping Method rpc Ping(PingRequest) returns (PingResponse); diff --git a/proto/cmp/services/transport/v1alpha1/search.proto b/proto/cmp/services/transport/v1alpha1/search.proto new file mode 100644 index 00000000..9b928802 --- /dev/null +++ b/proto/cmp/services/transport/v1alpha1/search.proto @@ -0,0 +1,100 @@ +syntax = "proto3"; + +// ## Transport Service +// +// The Transport Service is used for flights, trains, and buses. +// +// Any search message response in the Camino Messenger Protocol only includes +// dynamic data. Static data can be cached and kept up to data with the Product List +// and Product Details messages. +// +// This package is a WIP. +package cmp.services.transport.v1alpha1; + +import "cmp/services/transport/v1alpha1/search_parameters_types.proto"; +import "cmp/services/transport/v1alpha1/search_result_types.proto"; +import "cmp/services/transport/v1alpha1/source_types.proto"; +import "cmp/services/transport/v1alpha1/trip_types.proto"; +import "cmp/types/v1alpha1/common.proto"; +import "cmp/types/v1alpha1/search.proto"; +import "cmp/types/v1alpha1/traveller.proto"; + +// ### Transport Search Request +message TransportSearchRequest { + // Message header. Contains API version, message info string and end-user wallet + // address + cmp.types.v1alpha1.Header header = 1; + + // Search request metadata + cmp.types.v1alpha1.SearchRequestMetadata metadata = 2; + + // Generic search parameters + // + // Ex: Inclusion of OnRequest options and inclusion of only the cheapest or all + // options. + cmp.types.v1alpha1.SearchParameters search_parameters = 3; + + // Transport specific search parameters + // + // Ex: ?? + TransportSearchParameters search_parameters_transport = 4; + + // 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 = 5; + + // 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; + + // Remarks + string remarks = 9; +} + +message TransportSearchResponse { + // Message header. Contains API version, message info string and end-user wallet + // address + cmp.types.v1alpha1.Header header = 1; + + // Search response metadata + cmp.types.v1alpha1.SearchResponseMetadata metadata = 2; + + // Conten source types for this search request. + // + // Ex: ContentSourceType.CONTENT_SOURCE_TYPE_GDS, + // ContentSourceType.CONTENT_SOURCE_TYPE_NDC + // ContentSourceType.CONTENT_SOURCE_TYPE_3RD_PARTY + repeated ContentSourceType conten_source_types = 3; + + // Transit search results + repeated TransportSearchResult results = 4; +} + +// ### Transport Search Service +// +// Takes `TransportSearchRequest` message type and returns `TransportSearchResponse` +// message type. +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/transport/v1alpha1/search.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/transport/v1alpha1/search.proto.dot.svg) +service TransportSearchService { + rpc TransportSearch(TransportSearchRequest) returns (TransportSearchResponse); +} diff --git a/proto/cmp/services/transport/v1alpha1/search_parameters_types.proto b/proto/cmp/services/transport/v1alpha1/search_parameters_types.proto new file mode 100644 index 00000000..c8918a28 --- /dev/null +++ b/proto/cmp/services/transport/v1alpha1/search_parameters_types.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package cmp.services.transport.v1alpha1; + +// ### Transport Search Parameters +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/transport/v1alpha1/search_parameters_types.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/transport/v1alpha1/search_parameters_types.proto.dot.svg) +message TransportSearchParameters {} diff --git a/proto/cmp/services/transport/v1alpha1/search_result_types.proto b/proto/cmp/services/transport/v1alpha1/search_result_types.proto new file mode 100644 index 00000000..aff348fd --- /dev/null +++ b/proto/cmp/services/transport/v1alpha1/search_result_types.proto @@ -0,0 +1,63 @@ +syntax = "proto3"; + +package cmp.services.transport.v1alpha1; + +import "cmp/services/transport/v1alpha1/trip_types.proto"; +import "cmp/types/v1alpha1/cancel_policy.proto"; +import "cmp/types/v1alpha1/datetime_range.proto"; +import "cmp/types/v1alpha1/fulfillment.proto"; +import "cmp/types/v1alpha1/price.proto"; +import "cmp/types/v1alpha1/rate.proto"; +import "cmp/types/v1alpha1/service_fact.proto"; +import "cmp/types/v1alpha1/traveller.proto"; + +// Transport search result +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/transport/v1alpha1/search_option_types.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/transport/v1alpha1/search_option_types.proto.dot.svg) +message TransportSearchResult { + // Unique option ID for this search + int32 option_id = 1; + + // Offer ID. + // + // Option to carry through an offer identifier for other stateful provider systems + // like NDC AirShopping RS + string offer_id = 2; + + // Travellers + repeated cmp.types.v1alpha1.Traveller travellers = 3; + + // Travelling trip. See `search.proto` documentation + Trip travelling_trip = 4; + + // Returning trip. See `search.proto` documentation + Trip returning_trip = 5; + + // Total Price + 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; + + // Rate Rules + repeated cmp.types.v1alpha1.RateRule rate_rules = 10; + + // Fulfillment + repeated cmp.types.v1alpha1.Fulfillment fulfillments = 11; //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; + + // Cancel Policy + cmp.types.v1alpha1.CancelPolicy cancel_policy = 13; + + // Observations + string observations = 14; +} diff --git a/proto/cmp/services/transport/v1alpha1/source_types.proto b/proto/cmp/services/transport/v1alpha1/source_types.proto new file mode 100644 index 00000000..58b18d4c --- /dev/null +++ b/proto/cmp/services/transport/v1alpha1/source_types.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package cmp.services.transport.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) +enum ContentSourceType { + CONTENT_SOURCE_TYPE_UNSPECIFIED = 0; + CONTENT_SOURCE_TYPE_GDS = 1; + CONTENT_SOURCE_TYPE_NDC = 2; + CONTENT_SOURCE_TYPE_OWN_PRODUCT = 3; + CONTENT_SOURCE_TYPE_DIRECT_CONTRACT = 4; + CONTENT_SOURCE_TYPE_3RD_PARTY = 5; +} diff --git a/proto/cmp/services/transport/v1alpha1/trip_types.proto b/proto/cmp/services/transport/v1alpha1/trip_types.proto new file mode 100644 index 00000000..679fd24b --- /dev/null +++ b/proto/cmp/services/transport/v1alpha1/trip_types.proto @@ -0,0 +1,119 @@ +syntax = "proto3"; + +package cmp.services.transport.v1alpha1; + +import "cmp/types/v1alpha1/distance.proto"; +import "cmp/types/v1alpha1/location.proto"; +import "cmp/types/v1alpha1/price.proto"; +import "cmp/types/v1alpha1/time.proto"; +import "google/protobuf/timestamp.proto"; + +// ### Trip message type +// +// This message type represents a one way trip, either travelling or returning. +// +// ![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; + + // Arrival event + TransitEvent arrival = 4; + + // Trip segments + repeated TripSegment trip_segments = 5; +} + +// ### Trip Segment messag type +// +// A segment of a trip +message TripSegment { + // Segment ID + // Ex: "SEG1234" + string segment_id = 1; + + // Provider Code + // Ex: "AC" + string provider_code = 2; + + // Retailer Code, replacing Marketing carrier + // Ex: "BC" + string retailer_code = 3; + + // Sub Provider Code, replacing Operating carrier or identifying sub contracted + // services provided by other suppliers. + // + // Ex: "BC" + string sub_provider_code = 4; + + // Service Number + // + // Ex: "1234" + // + // FIXME: Should this be an integer? For flights yes, but for trains and + // transfers? + string service_number = 5; + + // Departure + TransitEvent departure = 6; + + // Arrival + TransitEvent arrival = 7; + + // Service description + // + // Ex: "Economy" + string service_description = 8; + + // Service code + // Ex: "Y" + string service_code = 9; + + // Trip Time + // + // Ex: Time(hours=2, minutes=45) + cmp.types.v1alpha1.Time trip_time = 10; + + // Trip Distance + // + // Ex: `Distance(value=15, unit=DistanceType.DISTANCE_UNIT_KILOMETERS)` + cmp.types.v1alpha1.Distance trip_distance = 11; + + // Min PAX + // + // Ex: `1` + int32 min_pax = 12; + + // Max PAX + // + // Ex: `3` + int32 max_max = 13; + + // Luggage + // + // Ex: `3` + int32 luggage = 14; + + // Price + // + // 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; +} diff --git a/proto/cmp/types/v1alpha1/address.proto b/proto/cmp/types/v1alpha1/address.proto new file mode 100644 index 00000000..71abd0a3 --- /dev/null +++ b/proto/cmp/types/v1alpha1/address.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +import "cmp/types/v1alpha1/location.proto"; + +// Address +// +// This type represents an address for a home or hotel etc. +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/address.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/address.proto.dot.svg) +message Address { + string line_1 = 1; + string line_2 = 2; + string district = 3; + int32 zip_code = 5; + GeoTree geo_tree = 6; +} diff --git a/proto/cmp/types/v1alpha1/asset.proto b/proto/cmp/types/v1alpha1/asset.proto new file mode 100644 index 00000000..2df27f6e --- /dev/null +++ b/proto/cmp/types/v1alpha1/asset.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +// An on-chain asset on the Camino Network +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/asset.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/asset.proto.dot.svg) +message Asset { + string asset_id = 1; + string name = 2; + string symbol = 3; + uint32 decimals = 4; +} diff --git a/proto/cmp/types/v1alpha1/basic_property_info.proto b/proto/cmp/types/v1alpha1/basic_property_info.proto deleted file mode 100644 index bc722510..00000000 --- a/proto/cmp/types/v1alpha1/basic_property_info.proto +++ /dev/null @@ -1,33 +0,0 @@ -syntax = "proto3"; - -/* - ## This is a package level description example - - This description is for package `cmp.types.v1alpha1` package. On the first file's description - with a non-empty comment before the `package` directive is used. Other's are ignored. - - ### Basics Package - - This package is a **WIP**. We will probably end up splitting this into smaller and more related - packages. -*/ -package cmp.types.v1alpha1; - -import "cmp/types/v1alpha1/coordinate.proto"; -import "cmp/types/v1alpha1/price.proto"; - -/* - Basic Property Info -*/ -message BasicPropertyInfo { - string property_name = 1; - string giata_id = 2; - int32 goal_id = 3; - string country = 4; - string country_code = 5; - string region = 6; - string city_or_resort = 7; - cmp.types.v1alpha1.Coordinate location = 8; // Location coordinate of the property - string status = 9; - cmp.types.v1alpha1.Price total_price = 10; -} diff --git a/proto/cmp/types/v1alpha1/cancel_policy.proto b/proto/cmp/types/v1alpha1/cancel_policy.proto index 55203f31..385afadb 100644 --- a/proto/cmp/types/v1alpha1/cancel_policy.proto +++ b/proto/cmp/types/v1alpha1/cancel_policy.proto @@ -2,25 +2,55 @@ syntax = "proto3"; package cmp.types.v1alpha1; -import "cmp/types/v1alpha1/currency.proto"; +import "cmp/types/v1alpha1/datetime_range.proto"; +import "cmp/types/v1alpha1/price.proto"; +import "google/protobuf/timestamp.proto"; -/* - Cancellation Penalty -*/ -message CancelPenalty { - string from = 2; // from field - string to = 3; // to field - float penalty = 4; // Penalty amount - cmp.types.v1alpha1.Currency currency = 5; // Penalty currency - string description = 6; // Description of the penalty - repeated string valid_for_rateplan = 7; // For which rateplans the penalty is valid for +// Cancellation Policy: The cancellation policy section consists of 3 options: +// +// - A simple boolean for refundable or non-refundable options +// - A "free cancellation upto" DateTime +// - Complete cancellation policies with from/to DateTime stamps +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/cancel_policy.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/cancel_policy.proto.dot.svg) +message CancelPolicy { + // Cancellation policy refundable or not + bool refundable = 1; + + // The "free cancellation upto" identifier specifies the exact DateTime upto when + // a booking can be cancelled free of charge. + google.protobuf.Timestamp free_cancellation_upto = 2; + + // Full cancellation policies can be complex and extensive. Inclusion in search + // messages should be avoided because they substantially increase the message size + // for each option and in general detailed cancellation information is required at + // a later step in the booking flow. + // + // Specify several date ranges with their penalties relative to the start + // date-time of the service. When in the inventory system several entries with + // different hours before specified, like for example 10€ from 240 hours (10 days) + // before consumption, 50€ from 5 days before consumption and 100€ from 24 hours + // before consumption, they must be computed to one uniform format of date ranges + // and penalties, related to the start DateTime of the service or product + // delivery. + repeated CancelPenalty cancel_penalties = 3; } -/* - Cancellation Policy -*/ -message CancelPolicy { - bool refundable = 1; // Cancellation policy refundable or not - string free_cancellation_policy_upto = 2; // __doc here__ - repeated CancelPenalty cancel_penalties = 3; // __doc here__ +//Cancellation Penalty +message CancelPenalty { + // When this penalty is valid. Either use the start and end date of the DateTime + // range + cmp.types.v1alpha1.DateTimeRange datetime_range = 1; + + // Penalty value. Percentages of the selling price are purposely not allowed for + // simplicity and uniformity. + cmp.types.v1alpha1.Price value = 2; + + // Description of the penalty in a non computable manner. The Description should + // be in the language that is specified in the request. + string description = 3; + + // For which rateplan the penalty is valid. + repeated string valid_for_rate_plan = 4; } diff --git a/proto/cmp/types/v1alpha1/common.proto b/proto/cmp/types/v1alpha1/common.proto index dc7654d5..3d636151 100644 --- a/proto/cmp/types/v1alpha1/common.proto +++ b/proto/cmp/types/v1alpha1/common.proto @@ -1,33 +1,33 @@ syntax = "proto3"; -// ## Camino Messenger Protocol Common Package +// ## Camino Messenger Protocol (CMP) Types Package // -// All CMP messages should import and use the header message type +// Commonly used message types across all CMP messages package cmp.types.v1alpha1; // ### CM Message Header // -// FIXME: Using version as a single int32 seems logical in my opinion. Less size -// and simple. -// FIXME: Do we really need the "info" field? -// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/common.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/common.proto.dot.svg) message Header { // Protocol Version Version version = 1; - // Message info - string info = 2; - // End-user wallet ID for personalization purposes - string end_user_wallet_address = 5; + string end_user_wallet_address = 2; } // Version message Version { - // API Version, major version which can have breaking changes (semantic versioning) + // API Version, major version which can have breaking changes (semantic + // versioning) int32 major = 1; - // API Version, minor version has backwards compatible new features (semantic versioning) + + // API Version, minor version has backwards compatible new features (semantic + // versioning) int32 minor = 2; - // API Version, patch version small improvements and bugfixes (semantic versioning) + + // API Version, patch version small improvements and bugfixes (semantic + // versioning) int32 patch = 3; } diff --git a/proto/cmp/types/v1alpha1/coordinate.proto b/proto/cmp/types/v1alpha1/coordinate.proto deleted file mode 100644 index cb766c23..00000000 --- a/proto/cmp/types/v1alpha1/coordinate.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; - -// ## This is a package level description example -// -// This description is for package `cmp.datatypes.coordinate.v1alpha1` package -package cmp.types.v1alpha1; - -// Coordinate -message Coordinate { - double longitude = 1; - double latitude = 2; -} diff --git a/proto/cmp/types/v1alpha1/country.proto b/proto/cmp/types/v1alpha1/country.proto index 465e421a..d72d92f9 100644 --- a/proto/cmp/types/v1alpha1/country.proto +++ b/proto/cmp/types/v1alpha1/country.proto @@ -2,11 +2,13 @@ syntax = "proto3"; package cmp.types.v1alpha1; -/* - ## Language options - - Country options according to ISO 3166-1, with the 31 most popular countries first, using fewer bytes in the code thus reducing message size. -*/ +// ### Language options +// +// Country options according to ISO 3166-1, with the 31 most popular countries +// first, using fewer bytes in the code thus reducing message size. +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/country.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/country.proto.dot.svg) enum Country { COUNTRY_UNSPECIFIED = 0; diff --git a/proto/cmp/types/v1alpha1/currency.proto b/proto/cmp/types/v1alpha1/currency.proto index c024f53f..94e2abff 100644 --- a/proto/cmp/types/v1alpha1/currency.proto +++ b/proto/cmp/types/v1alpha1/currency.proto @@ -2,13 +2,13 @@ syntax = "proto3"; package cmp.types.v1alpha1; -/* - ## Currency list of ISO 4217 standard - - ### First 20 currencies are the most traded currencies in the world - - This is done to optimize the size of the protobuf message -*/ +// ### Currency list of ISO 4217 standard +// +// First 20 currencies are the most traded currencies in the world. This is done to +// optimize the size of the protobuf message size. +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/currency.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/currency.proto.dot.svg) enum Currency { CURRENCY_UNSPECIFIED = 0; // Placeholder or unspecified currency diff --git a/proto/cmp/types/v1alpha1/date.proto b/proto/cmp/types/v1alpha1/date.proto index 18250d89..bff59f55 100644 --- a/proto/cmp/types/v1alpha1/date.proto +++ b/proto/cmp/types/v1alpha1/date.proto @@ -2,93 +2,10 @@ syntax = "proto3"; package cmp.types.v1alpha1; -/* - # Date Message - - --- START MARKDOWN TEST --- - - # Markdown Features - - ## Headers - - # Header 1 - ## Header 2 - ### Header 3 - #### Header 4 - ##### Header 5 - ###### Header 6 - - ## Text Emphasis - - *Italic* or _Italic_ - - **Bold** or __Bold__ - - **_Bold and Italic_** or ***Bold and Italic*** - - ~~Strikethrough~~ - - ## Lists - - ### Unordered - Does not work with asterisk (*) and also seems like sub lists are not supported. - - - Item 1 - - Item 2 - - Sub-item 2.1 - - Sub-item 2.2 - - ### Ordered - 1. First item - 2. Second item - 3. Third item - - ## Links - - [Chain4Travel AG](https://chain4travel.com//) - - ## Images - - ![C4TxHexens](https://api.strapi.camino.network//uploads/22976_c_0_0_1200_675_w_800_h_450_49e8683ec1.webp) - - ## Blockquotes - - > This is a blockquote. - - ## Inline Code - - Here is `inline code`. - - ## Code Blocks - - ```python - print("Hello, World!") - ``` - - ## Tables - - | Header 1 | Header 2 | - |----------|----------| - | Row1Col1 | Row1Col2 | - | Row2Col1 | Row2Col2 | - - ## Horizontal Rule - - --- - - ## Task Lists - - - [x] Completed task - - [ ] Incomplete task - - ## Line Breaks - - First line. - Second line. - - --- END MARKDOWN TEST --- - -*/ +// Date Message +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/date.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/date.proto.dot.svg) message Date { int32 year = 1; int32 month = 2; diff --git a/proto/cmp/types/v1alpha1/datetime_range.proto b/proto/cmp/types/v1alpha1/datetime_range.proto new file mode 100644 index 00000000..7a01b0c3 --- /dev/null +++ b/proto/cmp/types/v1alpha1/datetime_range.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +import "google/protobuf/timestamp.proto"; + +// Date Range Message +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/datetime_range.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/datetime_range.proto.dot.svg) +message DateTimeRange { + google.protobuf.Timestamp start_datetime = 1; + google.protobuf.Timestamp end_datetime = 2; +} diff --git a/proto/cmp/types/v1alpha1/distance.proto b/proto/cmp/types/v1alpha1/distance.proto index ade2515c..2d2a8167 100644 --- a/proto/cmp/types/v1alpha1/distance.proto +++ b/proto/cmp/types/v1alpha1/distance.proto @@ -2,19 +2,21 @@ syntax = "proto3"; package cmp.types.v1alpha1; -/* - Distance with unit -*/ +// Distance unit and value pair +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/distance.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/distance.proto.dot.svg) message Distance { int32 value = 1; DistanceUnit distance_unit = 2; } -/* Distance Unit */ +// Distance Unit enum DistanceUnit { DISTANCE_UNIT_UNSPECIFIED = 0; DISTANCE_UNIT_METERS = 1; DISTANCE_UNIT_KILOMETERS = 2; DISTANCE_UNIT_MILES = 3; DISTANCE_UNIT_FEET = 4; + DISTANCE_UNIT_YARDS = 5; } diff --git a/proto/cmp/types/v1alpha1/dow.proto b/proto/cmp/types/v1alpha1/dow.proto new file mode 100644 index 00000000..85022bf2 --- /dev/null +++ b/proto/cmp/types/v1alpha1/dow.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +// ### Day of Week +// +// DOW means DayOfWeek and is used to determine specific arrival days of the week a +// customer would like to go on holidays for example only travelling on a Saturday +// or Sunday. It is also used to express that a show, tour or excursion is only +// taking place on Sundays. Or that a forthnight Flotilla Sailing starts on +// Saturday. +// +// We are using a bitmask like this: +// +// With `dow=112` the intention is to express Friday, Saturday and Sunday, which is +// binary 1110000, which computes to `dow=112`, like just fri+sat is `110000` which +// computes to `dow=48` or Monday and Tuesday which computes to `dow=3`. +// +// This is easy to calculate with basic integer mathematics, like for Sunday + +// Wednesday you sum 64 + 4 = 68, so you set the field to 68. +// +// See this table with DOW logic: +// +// | DOW | Sunday | Saturday | Friday | Thursday | Wednesday | Tuesday | Monday | +// |:--------:|:---------:|:----------:|:--------:|:----------:|:---------:|:---------:|:--------:| +// | Binary | 1000000 | 0100000 | 0010000 | 0001000 | 0000100 | 0000010 | 0000001 | +// | Exponent | 2^6 | 2^5 | 2^4 | 2^3 | 2^2 | 2^1 | 2^0 | +// | Result | 64 | 32 | 16 | 8 | 4 | 2 | 1 | +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/dow.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/dow.proto.dot.svg) +message DayOfWeek { + int32 dow = 1; +} diff --git a/proto/cmp/types/v1alpha1/email.proto b/proto/cmp/types/v1alpha1/email.proto new file mode 100644 index 00000000..7d270385 --- /dev/null +++ b/proto/cmp/types/v1alpha1/email.proto @@ -0,0 +1,38 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +// Email +// +// Email type for hotels, holiday homes etc. +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/email.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/email.proto.dot.svg) +message Email { + string email = 1; + EmailType email_type = 2; + string email_type_other = 3; +} + +// Email Types +// +// FIXME: Check email types +enum EmailType { + EMAIL_TYPE_UNSPECIFIED = 0; + EMAIL_TYPE_OTHER = 1; // For emails that don't fit into other categories. + EMAIL_TYPE_RECEPTION = 2; // For accommodation properties like hotels. + EMAIL_TYPE_BOOKING = 3; // For booking confirmations. + EMAIL_TYPE_SUPPORT = 4; // General customer support. + EMAIL_TYPE_INQUIRY_RESPONSE = 5; // Responses to customer inquiries. + EMAIL_TYPE_TRANSPORT_INFO = 6; // Information regarding transport services. + EMAIL_TYPE_RENTAL_CONFIRMATION = 7; // Confirmation for car rentals. + EMAIL_TYPE_ACTIVITY_DETAILS = 8; // Details about booked activities or events. + EMAIL_TYPE_FEEDBACK_REQUEST = 9; // Requests for customer feedback. + EMAIL_TYPE_BILLING = 10; // Billing and payment related emails. + EMAIL_TYPE_CANCELLATION = 11; // Cancellation notices. + EMAIL_TYPE_REMINDER = 12; // Reminders for reservations or activities. + EMAIL_TYPE_PROMOTIONAL = 13; // Promotional emails, offers, discounts. + EMAIL_TYPE_UPDATES = 14; // Updates about services or policy changes. + EMAIL_TYPE_ALERTS = 15; // Alerts or important notices. + EMAIL_TYPE_NEWSLETTER = 16; // Regular newsletters. +} diff --git a/proto/cmp/types/v1alpha1/enrichment.proto b/proto/cmp/types/v1alpha1/enrichment.proto deleted file mode 100644 index 9ff5b7a4..00000000 --- a/proto/cmp/types/v1alpha1/enrichment.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; - -package cmp.types.v1alpha1; - -/* - ## Enrichment switch to include static data if it is not held in the distribution system - - **Inclusion of static data causing repeated provision and processing by all providers is contrary to the high volume and high performance philosophy - and should be avoided whenever possible** - - This is done to optimize the size of the protobuf message -*/ -enum Enrichment { - ENRICHMENT_UNSPECIFIED = 0; - ENRICHMENT_NONE = 1; // No static data to be added to the response to keep the message size as small as possible for fast transport and processing (default). - ENRICHMENT_FULL = 2; // All available static data will be added to the response by the provider, if available. This enlarges the message size and processing and leads to increased cost. - ENRICHMENT_THUMBNAIL = 3; // Only the minimal static data for a small search results display will be added to the response by the provider, if available. -} diff --git a/proto/cmp/types/v1alpha1/filter.proto b/proto/cmp/types/v1alpha1/filter.proto index e49b5230..7024409e 100644 --- a/proto/cmp/types/v1alpha1/filter.proto +++ b/proto/cmp/types/v1alpha1/filter.proto @@ -2,10 +2,22 @@ syntax = "proto3"; package cmp.types.v1alpha1; -// Filter +// Upfront filtering of possible search options in the search response +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/filter.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/filter.proto.dot.svg) message Filter { + // Filter code agreed between provider and distributor + // + // FIXME: Should filters be standardized per vertical? string filter_code = 1; + + // Description of the filter code. string filter_description = 2; - // FIXME: How many global types are there? Can this be an enum? - repeated string drv_globaltypes = 3; + + // A filter type can be set to for example "DRV GlobalTypes". + string filter_type = 3; + + // Adding a filter value like for example "star_rating=5" or "row_number=1". + string filter_value = 4; } diff --git a/proto/cmp/types/v1alpha1/fulfillment.proto b/proto/cmp/types/v1alpha1/fulfillment.proto new file mode 100644 index 00000000..c929d7cc --- /dev/null +++ b/proto/cmp/types/v1alpha1/fulfillment.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +// ### Fulfillment message type +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/fulfillment.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/fulfillment.proto.dot.svg) +message Fulfillment { + // Link type + // + // Ex: "LG" or "TC" + // + // FIXME: Enum? + string link_type = 1; + + // Link description + // + // Ex: "Baggage conditions" + string link_description = 2; + + // Link reference + // + // Ex: "https://api.lyko.tech/v2.1/transfers/ebaa9aed-dbc4-4d51-a41a-336a3c3e9bfc/pdf-terms-and-conditions" + string link_ref = 3; +} diff --git a/proto/cmp/types/v1alpha1/geo_location.proto b/proto/cmp/types/v1alpha1/geo_location.proto deleted file mode 100644 index c144b807..00000000 --- a/proto/cmp/types/v1alpha1/geo_location.proto +++ /dev/null @@ -1,43 +0,0 @@ -syntax = "proto3"; - -package cmp.types.v1alpha1; - -import "cmp/types/v1alpha1/coordinate.proto"; -import "cmp/types/v1alpha1/distance.proto"; - -// Geo Location Message -// Describes a geo location with location codes, geo circle, geo polygon, and -// geo tree. -message GeoLocation { - oneof geo_location { - LocationCodes location_codes = 1; - GeoCircle geo_circle = 2; - GeoPolygon geo_polygon = 3; - GeoTree geo_tree = 4; - } -} - -// Location Codes -message LocationCodes { - // List of location codes - repeated string location_codes = 1; -} - -// Geo Circle -message GeoCircle { - cmp.types.v1alpha1.Coordinate center = 1; - cmp.types.v1alpha1.Distance radius = 2; -} - -// Geo Polygon -message GeoPolygon { - // GPS points of the polygon - repeated cmp.types.v1alpha1.Coordinate points = 1; -} - -// Geo Tree -message GeoTree { - string country = 1; - string region = 2; - string city_or_resort = 3; -} diff --git a/proto/cmp/types/v1alpha1/language.proto b/proto/cmp/types/v1alpha1/language.proto index cb2412f2..f24129f4 100644 --- a/proto/cmp/types/v1alpha1/language.proto +++ b/proto/cmp/types/v1alpha1/language.proto @@ -2,12 +2,14 @@ syntax = "proto3"; package cmp.types.v1alpha1; -/* - ## Language options - - Language options according to ISO 639-1, with the 26 most popular languages first. - This is done to use the smaller values more frequently and thus consume less bytes for this field. -*/ +// ### Language options +// +// Language options according to ISO 639-1, with the 26 most popular languages +// first. This is done to use the smaller values more frequently and thus consume +// less bytes for this field. +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/language.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/language.proto.dot.svg) enum Language { LANGUAGE_UNSPECIFIED = 0; LANGUAGE_AR = 1; // Arabic diff --git a/proto/cmp/types/v1alpha1/location.proto b/proto/cmp/types/v1alpha1/location.proto new file mode 100644 index 00000000..263488f1 --- /dev/null +++ b/proto/cmp/types/v1alpha1/location.proto @@ -0,0 +1,97 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +import "cmp/types/v1alpha1/country.proto"; +import "cmp/types/v1alpha1/distance.proto"; + +// ### Coordinate +// +// Represents a geographic location +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/location.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/location.proto.dot.svg) +message Coordinate { + // The latitude in degrees. It must be in the range [-90.0, +90.0]. + double latitude = 1; + // The longitude in degrees. It must be in the range [-180.0, +180.0]. + double longitude = 2; +} + +// Geo Circle +message GeoCircle { + cmp.types.v1alpha1.Coordinate center = 1; + cmp.types.v1alpha1.Distance radius = 2; +} + +// Geo Polygon +message GeoPolygon { + // GPS points of the polygon + repeated cmp.types.v1alpha1.Coordinate points = 1; +} + +// Geo Tree +message GeoTree { + Country country = 1; + string region = 2; + string city_or_resort = 3; +} + +// Location Code +message LocationCode { + string location_codes = 1; + LocationCodeType location_code_type = 2; +} + +// Location Codes +// +// Represents a list of `LocationCode` message type. +// +// Protobuf `oneof` field type does not support repeated member fields. To get the +// same functionality we need to wrap the needed message type with another message. +message LocationCodes { + repeated LocationCode location_codes = 1; +} + +// Location Code Type +enum LocationCodeType { + LOCATION_CODE_TYPE_UNSPECIFIED = 0; + + LOCATION_CODE_TYPE_PROVIDER_CODE = 1; + + // IATA airport code + LOCATION_CODE_TYPE_IATA_CODE = 2; + + // ICAO airport code + LOCATION_CODE_TYPE_ICAO_CODE = 3; + + // A 3-character code used for train stations. Previously referred to as CRS + // (Computer Reservation System) or NRS (National Reservation System) codes. + LOCATION_CODE_TYPE_3ALPHA_CODE = 4; + + // A 6-digit code for train stations generally used for retail purposes + LOCATION_CODE_TYPE_NLC_CODE = 5; + + // Codes relating to points used in deriving train schedules + LOCATION_CODE_TYPE_TIPLOC_CODE = 6; + + // These codes can refer to locations such as sidings and junctions. STANOX codes + // are grouped by geographical area - the first two digits specify the area in + // which the location exists. + LOCATION_CODE_TYPE_STANOX_CODE = 7; + + // Used by multi-modal journey planners and timetables + LOCATION_CODE_TYPE_ATCO_CODE = 8; + + // Used in combination with the Google Places API + LOCATION_CODE_TYPE_GOOGLE_PLACE_ID = 9; + + // Used in combination with the Foursquare Places API + LOCATION_CODE_TYPE_FOURSQUARE_FSQ_ID = 10; + + // Used in combination with the OSM Overpass API + LOCATION_CODE_TYPE_OPENSTREETMAPS_REF = 11; + + // Used in combination with the HERE Places API + LOCATION_CODE_TYPE_HERE_ID = 12; +} diff --git a/proto/cmp/types/v1alpha1/meal_plan.proto b/proto/cmp/types/v1alpha1/meal_plan.proto new file mode 100644 index 00000000..fcc0b1fb --- /dev/null +++ b/proto/cmp/types/v1alpha1/meal_plan.proto @@ -0,0 +1,39 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +// Meal Plan message type +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/mealplan.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/mealplan.proto.dot.svg) +message MealPlan { + // Meal Plan Code + // + // Ex: `MealPlan.MEAL_PLAN_AI` for "All Inclusive" meal plan. + MealPlanCode meal_plan_code = 1; + + // Mealplan description. In case of enrichment additional description of the unit code. + // + // Ex: "All Inclusive" + string meal_plan_description = 2; +} + +// Meal plan code ENUM type +enum MealPlanCode { + MEAL_PLAN_CODE_UNSPECIFIED = 0; // No Mealplan specified + MEAL_PLAN_CODE_AI = 1; // All Inclusive + MEAL_PLAN_CODE_AI_PLUS = 2; // All Inclusive + additional services + MEAL_PLAN_CODE_AI_MINUS = 3; // All Inclusive Light + MEAL_PLAN_CODE_AIU = 4; // Ultra All Inclusive + MEAL_PLAN_CODE_BB = 5; // Bed & Breakfast + MEAL_PLAN_CODE_DO = 6; // Dinner Only + MEAL_PLAN_CODE_FB = 7; // Full Board + MEAL_PLAN_CODE_FB_PLUS = 8; // Full Board + additional services + MEAL_PLAN_CODE_HB = 9; // Half Board + MEAL_PLAN_CODE_HB_PLUS = 10; // Half Board + additional services + MEAL_PLAN_CODE_LO = 11; // Lunch Only + MEAL_PLAN_CODE_RO = 12; // Room Only + MEAL_PLAN_CODE_DB = 13; // Dinner Buffet + MEAL_PLAN_CODE_SC = 14; // Self Catering + MEAL_PLAN_CODE_AP = 15; // Acording to Programme* +} diff --git a/proto/cmp/types/v1alpha1/partner.proto b/proto/cmp/types/v1alpha1/partner.proto new file mode 100644 index 00000000..062c0869 --- /dev/null +++ b/proto/cmp/types/v1alpha1/partner.proto @@ -0,0 +1,162 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +import "cmp/types/v1alpha1/token.proto"; +import "cmp/types/v1alpha1/wallet.proto"; + +// ### Partner message type +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/partner.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/partner.proto.dot.svg) +message Partner { + // Short name of the partner. Ex: Chain4Travel + string short_name = 1; + + // Legal name of the partner. Ex: Chain4Travel AG + string legal_name = 2; + + // Business description + string business_description = 3; + + // Domain for the partner + // + // Ex: chain4travel.com + // + // Provider should create two DNS records for their address to verify they own + // the `partner_wallet_address` below. Two records should be for public key and + // the corresponding address. + // + // Example DNS TXT Records: + // `@ IN TXT "camino-t-addr=T-camino1tdkgjhfjq8z4glnvu8davxvdm66jx55tfr6qnz" TTL 3600` + // `@ IN TXT "camino-pubkey=043134d4b70236e59f99ae9e6ed9d1d512bacfa83506c9371ff4e372b7837844d82b1c56d81d04a23e25b18ff3f7eb531a5ef17df3bf5730b29e13f854a65b4651" TTL 3600` + // + // FIXME: Need review here! + string domain = 4; + + // On chain payment support + bool on_chain_payment_supported = 5; + + // Supported tokens for payment on-chain + // + // Note: Type of this field will depend on the T-Chain implementation If we go + // with X-Chain like (assets) we may need to switch to `Asset` type. + repeated ERC20Token supported_tokens = 6; + + // Off chain payment support + bool off_chain_payment_supported = 7; + + // Supported services + repeated PartnerService services = 8; + + // Partner addresses of the messenger bots + repeated cmp.types.v1alpha1.WalletAddress addresses = 9; + + // Partner's consortium member wallet address. This address should be the one who + // creates the entry in Partner Configuration on the chain. + cmp.types.v1alpha1.WalletAddress partner_wallet_address = 10; +} + +// Partner Service +// +// Message representing a service sold by a partner. +message PartnerService { + // Name of the service. + // + // FIXME: Should we include package name also here? If not, how should the bot + // suppossed to find the message? If yes, package name also includes the version + // which means partner will need to update supported services with every new + // version. + // + // Ex: "cmp.services.accommodation.v1alpha1.AccommodationSearchService" + string service_name = 1; + + // Response of the service. + // + // Ex: "cmp.services.accommodation.v1alpha1.AccommodationSearchResponse" + // + // FIXME: Do we need this? One can check the service definition and see the + // response message type. + string response_name = 2; + + // Result field + // + // Ex: "options" representing the field at + // "cmp.services.accommodation.v1alpha1.AccommodationSearchResponse.options" which + // is a SearchOption type + string result_field = 3; + + // Result Type. + // + // Ex: ResultType.RESULT_TYPE_DISCRETE + ResultType result_type = 4; + + // Default bundled price for the service + BundledPrice bundled_price = 5; + + // Exclusive bundled prices for specific addresses. + // + // This field should be a serialized proto message of `CustomBundledPrice` type. + // The field's scalar type is `bytes` on purpose, so it can be encrypted if it's + // desired. + repeated bytes custom_bundled_prices = 6; +} + +// Custom Bundle Price +// +// This message encapsulates `BundledPrice` message to be used for a custom price +// per buyer. If it's required, this message can be encrypted before adding it to +// the `PartnerService` message type. +message CustomBundledPrice { + // Address of the wallet that the bundled price below is valid for. + string address = 1; + + // Bundled price that is exclusive to the wallet address above. + BundledPrice bundled_price = 2; +} + +// Bundled Price +// +// Message representing a bundled price of a service. +message BundledPrice { + // Bundle size. + // + // Example for a chat bot: 1 + // + // Example for SearchOptions: 100 + int32 results_per_bundle = 1; + + // Bundle Unit, represents the bundle's unit. For example for search results it + // should be `BundleUnit.BUNDLE_UNIT_COUNT` or for AI Chat bot results it can be + // `BundleUnit.BUNDLE_UNIT_BYTES` or `BundleUnit.BUNDLE_UNIT_KILOBYTES` + BundleUnit results_per_bundle_unit = 2; + + // Price per bundle, in nCAMs + // + // Ex: 100 + int64 price_per_bundle = 3; +} + +// Bundle unit message type +enum BundleUnit { + BUNDLE_UNIT_UNSPECIFIED = 0; + BUNDLE_UNIT_COUNT = 1; + BUNDLE_UNIT_BYTES = 2; + BUNDLE_UNIT_KILOBYTES = 3; + BUNDLE_UNIT_MEGABYTES = 4; + // BUNDLE_UNIT_CHARACTERS = 5; // Characters, words?? +} + +enum ResultType { + RESULT_TYPE_UNSPECIFIED = 0; + + // Objects countable with integers, like the SearchOption of an + // `AccommodationSearchResponse` + RESULT_TYPE_DISCRETE = 1; + + // Continous data types like strings. + // + // Ex: A response from a chat bot can be 100 chars long or 20000 chars long. Or in + // bytes or kilobytes for some binary data. + RESULT_TYPE_NON_DISCRETE = 2; +} diff --git a/proto/cmp/types/v1alpha1/passenger.proto b/proto/cmp/types/v1alpha1/passenger.proto deleted file mode 100644 index 7d70e58b..00000000 --- a/proto/cmp/types/v1alpha1/passenger.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; - -// import "tcm/protobuf/traveller.proto"; -// import "tcm/protobuf/travel_period.proto"; - -package cmp.types.v1alpha1; - -message Passenger { - // Todo: Create Passenger message -} diff --git a/proto/cmp/types/v1alpha1/phone.proto b/proto/cmp/types/v1alpha1/phone.proto new file mode 100644 index 00000000..24d4e97b --- /dev/null +++ b/proto/cmp/types/v1alpha1/phone.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +// Phone +// +// Phone type for hotels, holiday homes etc +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/phone.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/phone.proto.dot.svg) +message Phone { + string phone = 1; + PhoneType phone_type = 2; + string phone_type_other = 3; +} + +enum PhoneType { + PHONE_TYPE_UNSPECIFIED = 0; + PHONE_TYPE_OTHER = 1; // For phone numbers that don't fit into other categories. + PHONE_TYPE_RECEPTION = 2; // For accommodation properties like hotels. + PHONE_TYPE_BOOKING = 3; // Booking-related inquiries. + PHONE_TYPE_SUPPORT = 4; // Customer support and service. + PHONE_TYPE_INQUIRIES = 5; // General inquiries. + PHONE_TYPE_TRANSPORT_SERVICE = 6; // Transport services, like taxi or shuttle services. + PHONE_TYPE_RENTAL_SERVICE = 7; // Car rental service numbers. + PHONE_TYPE_ACTIVITY_COORDINATOR = 8; // Coordinators for activities or events. + PHONE_TYPE_BILLING = 9; // Billing and payment inquiries. + PHONE_TYPE_EMERGENCY = 10; // Emergency contact numbers. + PHONE_TYPE_FAX = 11; // Fax numbers. + PHONE_TYPE_MOBILE = 12; // Mobile phone numbers. + PHONE_TYPE_HOME = 13; // Home phone numbers. + PHONE_TYPE_BUSINESS = 14; // Business or office phone numbers. + PHONE_TYPE_TOLL_FREE = 15; // Toll-free numbers. + PHONE_TYPE_HOTLINE = 16; // Hotlines, for specialized support or services. +} diff --git a/proto/cmp/types/v1alpha1/price.proto b/proto/cmp/types/v1alpha1/price.proto index 74bc08f5..a13a490b 100644 --- a/proto/cmp/types/v1alpha1/price.proto +++ b/proto/cmp/types/v1alpha1/price.proto @@ -4,13 +4,47 @@ package cmp.types.v1alpha1; import "cmp/types/v1alpha1/currency.proto"; -// Price +// ### PriceDetail +// +// This message consists of net value as a Price object and additional fields as +// gross, binding, concept, and breakdown. +// +// Breakdown is a recursively inhereted object of PriceDetail. This way complex +// pricing structures can be represented. +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/price.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/price.proto.dot.svg) +message PriceDetail { + // Principle price element + Price price = 1; + + // gross price in case taxes or commissions are specified + float gross = 2; + + // Identification whether the gross price must be respected towards the end-user + // and the product or service cannot be offered for a lower price. + bool binding = 3; + + // Description of the product or service this price(element) is valid for. + string description = 4; + + // Type of price + string type = 5; + + // Type code of the price + string type_code = 6; + + // Description + int32 units = 7; + + // We can use a single PriceDetail to represent a price breakdown. + repeated PriceDetail breakdown = 8; +} + +// ### Simple Price type +// +// Consists of a net value and a Currency type. message Price { cmp.types.v1alpha1.Currency currency = 1; float net = 2; - float gross = 3; - bool binding = 4; - string concept = 5; // FIXME: Can this be an enum? - // We can use a single price to represent a price breakdown - repeated Price breakdown = 6; } diff --git a/proto/cmp/types/v1alpha1/rate.proto b/proto/cmp/types/v1alpha1/rate.proto new file mode 100644 index 00000000..3554ea9a --- /dev/null +++ b/proto/cmp/types/v1alpha1/rate.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +// Rate Rule +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/rate.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/rate.proto.dot.svg) +message RateRule { + RateRuleType rate_type = 1; + string rate_description = 2; + string rate_reference = 3; +} + +// Rate Rule Type +enum RateRuleType { + RATE_RULE_TYPE_UNSPECIFIED = 0; + RATE_RULE_TYPE_FLEXIBLE = 1; + RATE_RULE_TYPE_RESELLABLE = 2; + RATE_RULE_TYPE_NON_REFUNDABLE = 3; + RATE_RULE_TYPE_SEMI_NON_REFUNDABLE = 4; +} + +// Rate plan message type. Contains `rate_plan` and `rate_plan_description` fields +// as strings. +message RatePlan { + // Rate plan + // + // Ex: ??? + string rate_plan = 1; + + // Rateplan description. In case of enrichment additional description of the unit code. + // + // Ex: "Package Rate" + string rate_plan_description = 2; +} diff --git a/proto/cmp/types/v1alpha1/search.proto b/proto/cmp/types/v1alpha1/search.proto new file mode 100644 index 00000000..6e1829ef --- /dev/null +++ b/proto/cmp/types/v1alpha1/search.proto @@ -0,0 +1,122 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +import "cmp/types/v1alpha1/country.proto"; +import "cmp/types/v1alpha1/currency.proto"; +import "cmp/types/v1alpha1/filter.proto"; +import "cmp/types/v1alpha1/language.proto"; +import "cmp/types/v1alpha1/location.proto"; +import "cmp/types/v1alpha1/meal_plan.proto"; +import "cmp/types/v1alpha1/rate.proto"; +import "cmp/types/v1alpha1/sorting.proto"; +import "cmp/types/v1alpha1/uuid.proto"; + +// Search parameters for the search requests +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/search.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/search.proto.dot.svg) +message SearchParameters { + // Requested currency in which prices have to be supplied in the response + // according to ISO 4217 Currency codes + Currency currency = 1; + + // Requested language setting for descriptions in the response according to ISO + // 639-1 Language codes + Language language = 2; + + // Request generated for a specific market according to ISO 3166-1 Country codes + Country market = 3; + + // Include OnRequest options in the response or only immediately bookable options + bool include_on_request = 4; + + // Only show the cheapest option for one product, or include all possible + // combinations + bool include_combinations = 5; + + // Limit the maximum number of options included in the response + int32 max_options = 6; + + // Specify the sorting required in the response + Sorting sorting = 7; + + // Filters for the search. Various provider and product specific filters can be + // provided here in agreed name/value pairs. + repeated Filter filters = 8; + + // Free-text field to provide more detials for better offer personalization. This + // field can be provided in combination with a Geo location or as stand-alone. + string search_description_text = 9; + + // The speech is provided as a link to a recording to process for better offer + // personalization. This field can be provided in combination with a Geo location + // or as stand-alone. + string search_description_audio_url = 10; +} + +message SearchParametersSpecific { + // Geo Location for search, set only one of the fields at once. + // + // This one of field enforces only one of the fields below. They all share memory, + // setting one will remove the others. + oneof geo_location { + // FIXME: Do we need a list of location code here? Other fields are not lists. + LocationCodes location_codes = 9; + + // Single geographic point represented by two double fields. + Coordinate location_coordinate = 10; + + // Geo tree type, representted by Country, Region, and City_or_Resort. + GeoTree location_geo_tree = 11; + + // Geo circle. Represented by a coordinate and a distance for radius. + GeoCircle location_geo_circle = 12; + + // Geo polygon. Represented by a list of coordinate points. + GeoPolygon location_geo_polygon = 13; + } + + // Mealplan codes + repeated MealPlan meal_plan_codes = 16; + + // Rate plans + repeated RatePlan rate_plan = 17; + + // Rate Rules + // + // FIXME: Did we decided to remove this from SearchParameters? Maybe some + // users/distributors would want to search for only RESELLABLE offers? + repeated RateRule rate_rules = 18; +} + +// Search Response Metadata +message SearchRequestMetadata { + // An identifier for external sessions, aiding in tracking and continuity across + // sessions. + string external_session_id = 1; +} + +// Search Response Metadata +message SearchResponseMetadata { + // Context for Inventory system communication. + string context = 1; + + // Errors encountered in the generation of the response. Standardized error list + // to be created. + string errors = 2; + + // Warnings encountered in the generation of the response. + string warnings = 3; + + // Supplier code from the Inventory System for this search response. + string supplier_code = 4; + + // An identifier for external sessions, aiding in tracking and continuity across + // sessions. + string external_session_id = 5; + + // Search_id to be used in the Validation Request. This must be a UUID according + // to RFC 4122 + UUID search_id = 6; +} diff --git a/proto/cmp/types/v1alpha1/search_option.proto b/proto/cmp/types/v1alpha1/search_option.proto deleted file mode 100644 index d66fb84a..00000000 --- a/proto/cmp/types/v1alpha1/search_option.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; - -package cmp.types.v1alpha1; - -import "cmp/types/v1alpha1/basic_property_info.proto"; -import "cmp/types/v1alpha1/cancel_policy.proto"; -import "cmp/types/v1alpha1/service_fact.proto"; - -// Search Option -// -// This is for basic property search response's search options -message SearchOption { - string id = 1; - string property_code = 2; - BasicPropertyInfo basic_property_info = 3; - repeated cmp.types.v1alpha1.ServiceFact included_services = 4; - repeated cmp.types.v1alpha1.ServiceFact compulsory_extras = 5; - repeated cmp.types.v1alpha1.ServiceFact optional_extras = 6; - repeated string rate_rules = 7; - CancelPolicy cancel_policy = 8; - string remarks = 9; -} diff --git a/proto/cmp/types/v1alpha1/service_fact.proto b/proto/cmp/types/v1alpha1/service_fact.proto index 5fa55581..3767f8b2 100644 --- a/proto/cmp/types/v1alpha1/service_fact.proto +++ b/proto/cmp/types/v1alpha1/service_fact.proto @@ -2,28 +2,37 @@ syntax = "proto3"; package cmp.types.v1alpha1; +import "cmp/types/v1alpha1/price.proto"; + // Service Fact // // Example: +// +// ```json // { -// "fact" : "Breakage deposit in cash", -// "value" : "500€" +// "description" : "Electricity (price per kWh)", +// "price" : { +// "net": 100, +// "currency": Currency.CURRENCY_EURO +// }, // }, // { -// "fact" : "Electricity", -// "value" : "1€ per kWh" +// "description" : "Local tax (16+) (price per person/day)", +// "price" : { +// "net": 2, +// "currency": Currency.CURRENCY_EURO +// }, // }, // { -// "fact" : "local tax (16+)", -// "value" : "2€ per person/day" -// }, -// { { -// "fact" : "Laundry (initial supply of bed linen and towels)" +// "description" : "Laundry (initial supply of bed linen and towels)" // }, // { -// "fact" : "Wireless internet access (WIFI)" +// "description" : "Wireless internet access (WIFI)" // }, +// ``` +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/service_fact.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/service_fact.proto.dot.svg) message ServiceFact { - string fact = 1; - string value = 2; + string description = 1; + Price price = 2; } diff --git a/proto/cmp/types/v1alpha1/sorting.proto b/proto/cmp/types/v1alpha1/sorting.proto new file mode 100644 index 00000000..1004a061 --- /dev/null +++ b/proto/cmp/types/v1alpha1/sorting.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +// Sorting type and order +// +// This is being used in requests to specify the sorting required in the response. +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/sorting.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/sorting.proto.dot.svg) +message Sorting { + SortingType sorting_type = 1; + SortingOrder sorting_order = 2; +} + +// Sorting type +enum SortingType { + SORTING_TYPE_UNSPECIFIED = 0; + SORTING_TYPE_PRICE = 1; + SORTING_TYPE_POPULARITY = 2; + SORTING_TYPE_DISTANCE = 3; + SORTING_TYPE_RATING = 4; +} + +// Sorting order +enum SortingOrder { + SORTING_ORDER_UNSPECIFIED = 0; + SORTING_ORDER_ASCENDING = 1; + SORTING_ORDER_DESCENDING = 2; +} diff --git a/proto/cmp/types/v1alpha1/time.proto b/proto/cmp/types/v1alpha1/time.proto new file mode 100644 index 00000000..df893545 --- /dev/null +++ b/proto/cmp/types/v1alpha1/time.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +// Time Message +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/time.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/time.proto.dot.svg) +message Time { + int32 hours = 1; + int32 minutes = 2; +} diff --git a/proto/cmp/types/v1alpha1/token.proto b/proto/cmp/types/v1alpha1/token.proto new file mode 100644 index 00000000..81439074 --- /dev/null +++ b/proto/cmp/types/v1alpha1/token.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +// ERC20 Token Reference +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/token.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/token.proto.dot.svg) +message ERC20Token { + string contract_address = 1; + string name = 2; + string symbol = 3; + uint32 decimals = 4; +} diff --git a/proto/cmp/types/v1alpha1/travel_period.proto b/proto/cmp/types/v1alpha1/travel_period.proto index 9b9b6b04..67c3d081 100644 --- a/proto/cmp/types/v1alpha1/travel_period.proto +++ b/proto/cmp/types/v1alpha1/travel_period.proto @@ -3,14 +3,50 @@ syntax = "proto3"; package cmp.types.v1alpha1; import "cmp/types/v1alpha1/date.proto"; +import "cmp/types/v1alpha1/dow.proto"; -// // Travel Period // +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/travel_period.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/travel_period.proto.dot.svg) message TravelPeriod { + // Start date of a trip for messages where no Date/Time is required + // (datetime_range.proto) when the travelling starts. Most trips will be for an + // exact start and end date. In that case just these two fields are used. We + // discourage the use of only a start date and Length of Stay. cmp.types.v1alpha1.Date start_date = 1; + + // End date of a trip for messages where no Date/Time is required + // (datetime_range.proto) when the travelling ends. The end date is different when + // the trip is a one-way from point A to B compared to when the trip is a + // fortnight holiday and the customers return home on the end date. cmp.types.v1alpha1.Date end_date = 2; - bool flexible = 3; // FIXME: Boolean? + + // Start and end date can be set wider than the desired length of a trip, so that + // various alternatives can be considered. + // + // Ex: start date = 1 April, End date is 30 June, stay would be for 7 nights. + // + // Setting the boolean to true means that the period between start and end date + // should be more than the Length of Stay. + bool flexible = 3; + + // Setting the length of the trip in case of a flexible search. + // + // Ex: start date = 1 April, End date is 30 June, stay would be for 7 to 7 nights. + // + // Ex: start date = 1 April, End date is 30 June, stay would be for 7 to 10 nights. + // + // The arrival and departure must fall between start and end-date. int32 los_from_nights = 4; + int32 los_to_nights = 5; + + // By adding a DayOfWeek restriction, the number of results can be reduced to the + // specific arrival days in the interest of the end-customer who for example only + // can travel during weekends or at the contrary desires to avoid the crowds by + // travelling during weekdays. + // + // A bitmask is being used to express the DOW or DOWs. + cmp.types.v1alpha1.DayOfWeek dow = 6; } diff --git a/proto/cmp/types/v1alpha1/traveller.proto b/proto/cmp/types/v1alpha1/traveller.proto index 0d5ae58a..7b0ba870 100644 --- a/proto/cmp/types/v1alpha1/traveller.proto +++ b/proto/cmp/types/v1alpha1/traveller.proto @@ -2,25 +2,39 @@ syntax = "proto3"; package cmp.types.v1alpha1; +import "cmp/types/v1alpha1/country.proto"; import "cmp/types/v1alpha1/date.proto"; -// // Traveller // +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/traveller.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/traveller.proto.dot.svg) message Traveller { - // Traveller type from enum below - TravellerType type = 1; + // Guest number, the lowest number is the lead-pax + int32 guest_number = 1; - // Age - // FIXME: Do we need both age & birthdate? (Protobuf fields are optional, so - // we can keep it also) - int32 age = 2; + // FIXME: Why we need both traveller type and birthday? + + // Traveller type from enum below + TravellerType type = 2; // Birthdate cmp.types.v1alpha1.Date birthdate = 3; - // FIXME: An enum for this field will reduce the message size. - string nationality = 4; + // The country code for the nationality of the traveller. + // + // FIXME: Or should we have instead of "UK" "English"? + cmp.types.v1alpha1.Country nationality = 4; + + //Gender from the enum below + GenderType gender = 5; + + string first_names = 6; // FIXME: Why plural here? And not in last name? + string last_name = 7; + string second_last_name = 8; + string phone_number = 9; + string email = 10; + string document_number = 11; } // Traveller Type @@ -31,3 +45,12 @@ enum TravellerType { TRAVELLER_TYPE_INFANT = 3; TRAVELLER_TYPE_SENIOR = 4; } + +// Gender Type +enum GenderType { + GENDER_TYPE_UNSPECIFIED = 0; + GENDER_TYPE_MALE = 1; + GENDER_TYPE_FEMALE = 2; + GENDER_TYPE_NONBINARY = 3; + GENDER_TYPE_AGENDER = 4; +} diff --git a/proto/cmp/types/v1alpha1/uuid.proto b/proto/cmp/types/v1alpha1/uuid.proto new file mode 100644 index 00000000..a4ce40f7 --- /dev/null +++ b/proto/cmp/types/v1alpha1/uuid.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +// ### UUID message type +// +// This must be a UUID according to RFC 4122 standard. +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/uuid.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/uuid.proto.dot.svg) +message UUID { + string value = 1; +} diff --git a/proto/cmp/types/v1alpha1/wallet.proto b/proto/cmp/types/v1alpha1/wallet.proto new file mode 100644 index 00000000..add02dd8 --- /dev/null +++ b/proto/cmp/types/v1alpha1/wallet.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +package cmp.types.v1alpha1; + +// Address and public key for a wallet +// +// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/wallet.proto.dot.xs.svg) +// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/wallet.proto.dot.svg) +message WalletAddress { + // Wallet address + // + // Example: `T-camino1tdkgjhfjq8z4glnvu8davxvdm66jx55tfr6qnz` + string address = 1; + + // Public key for the address above + // + // Example: + // `043134d4b70236e59f99ae9e6ed9d1d512bacfa83506c9371ff4e372b7837844d82b1c56d81d04a23e25b18ff3f7eb531a5ef17df3bf5730b29e13f854a65b4651` + string public_key = 2; +} diff --git a/scripts/buf-installer.sh b/scripts/buf-installer.sh new file mode 100755 index 00000000..322ba8ca --- /dev/null +++ b/scripts/buf-installer.sh @@ -0,0 +1,127 @@ +#!/bin/bash + +# Functions +show_help() { + echo "This script downloads and installs the buf CLI utility." + echo "Usage: $0 [OPTION]" + echo "" + echo "Options:" + echo " --version=VERSION Install a specific version of buf, Ex: v1.28.1" + echo " --do-not-validate Do not validate version from releases" + echo " --list List available versions without installing" + echo " --help Display this help message" +} + +validate_dependencies() { + for dep in curl jq; do + command -v $dep >/dev/null 2>&1 || { echo >&2 "This script requires $dep but it's not installed. Aborting."; exit 1; } + done +} + +get_available_versions() { + curl -s "${GITHUB_API_URL_RELEASES}" | jq -r '.[].tag_name' +} + +validate_version() { + local available_versions=$1 + local version_regex="^$VERSION$" + if ! grep -qx "$version_regex" <<< "$available_versions"; then + echo -e "Error: Version '$VERSION' not found. \nAvailable versions: \n$available_versions" >&2 + exit 1 + fi +} + +list_versions() { + local available_versions=$1 + echo "Available buf versions:" + echo "$available_versions" + exit 0 +} + +download_and_install() { + local version=$1 + local temp_file=$(mktemp) + + # Download the file + local download_url="https://github.com/bufbuild/buf/releases/download/${version}/buf-$(uname -s)-$(uname -m)" + echo "Downloading: $download_url" + if ! curl -sSL "$download_url" -o "$temp_file"; then + echo "Error: Failed to download buf version ${version}." + rm -f "$temp_file" + exit 1 + fi + + # Move the file to the bin directory + if ! mv "$temp_file" "${BIN}/buf"; then + echo "Error: Failed to move buf to ${BIN}." + rm -f "$temp_file" + exit 1 + fi + + # Set executable permissions + if ! chmod +x "${BIN}/buf"; then + echo "Error: Failed to set executable permissions on buf." + exit 1 + fi + + echo "buf version ${version} installed successfully." +} + +VERSION="" +LIST_ONLY=false +SHOW_HELP=false +DO_NOT_VALIDATE=false + +# Bin directory for installation +BIN="/usr/local/bin" + +# Github URLs +GITHUB_API_URL_RELEASES="https://api.github.com/repos/bufbuild/buf/releases" +GITHUB_API_URL_LATEST="${GITHUB_API_URL_RELEASES}/latest" + +# Parse arguments +while [[ $# -gt 0 ]]; do + case $1 in + --version=*) + VERSION="${1#*=}" + ;; + --do-not-validate) + DO_NOT_VALIDATE=true + ;; + --list) + LIST_ONLY=true + ;; + --help) + SHOW_HELP=true + ;; + *) + echo "Unknown option: $1" >&2 + exit 1 + ;; + esac + shift +done + +if [[ "$SHOW_HELP" == true ]]; then + show_help + exit 0 +fi + +validate_dependencies + +if [[ "$LIST_ONLY" == true ]] || { [[ -n "$VERSION" ]] && [[ "$DO_NOT_VALIDATE" != true ]]; }; then + AVAILABLE_VERSIONS=$(get_available_versions) +fi + +if [[ "$LIST_ONLY" == true ]]; then + list_versions "$AVAILABLE_VERSIONS" + exit 0 +fi + +if [[ -z "$VERSION" ]]; then + VERSION=$(curl -sSL "${GITHUB_API_URL_LATEST}" | jq -r '.tag_name') +elif [[ "$DO_NOT_VALIDATE" != true ]]; then + validate_version "$AVAILABLE_VERSIONS" +fi + +download_and_install "$VERSION" diff --git a/scripts/generate_protodot.sh b/scripts/generate_protodot.sh new file mode 100755 index 00000000..dfd58c39 --- /dev/null +++ b/scripts/generate_protodot.sh @@ -0,0 +1,91 @@ +#!/bin/env bash +# +# Generates diagrams from the given path, walking through the path +# and running protodot for each .proto file. + +PROTODOT="protodot" +GENERATED_DIR="${1:-gen}" +PROTO_DIR="${2:-proto/cmp}" +PROTODOT_DIR="${3:-diagrams}" +VERSION="v1alpha1" + +declare -a BIG_ENUMS=( + "country.proto" + "currency.proto" + "language.proto" +) + +declare -a TRUNCATE=() + +# Usage: shorten_protobuf "path/to/country.proto" +shorten_protobuf() { + local filename="$1" + + # Check if the file exists + if [[ ! -f "$filename" ]]; then + echo "File not found: $filename" + return 1 + fi + + # Create a backup of the original file + cp -v "$filename" "${filename}.bak" + + # Process the file + awk ' + BEGIN { print_flag=1; enum_count=0; } + /enum [^ ]+ {/ { print_flag=0; print; next; } + /}/ { if (print_flag == 0) { print " X_TRUNCATED_X = 999;"; print; print_flag=1; } else { print; } next; } + { if (print_flag) { print; } else { if (enum_count < 7) { print; enum_count++; } } } + ' "$filename" > "${filename}.tmp" + + # Replace original file with modified file + mv -v "${filename}.tmp" "$filename" +} + +# Usage: revert_protobuf "path/to/country.proto" +revert_protobuf() { + local filename="$1" + + # Check if the backup file exists + local backup_filename="${filename}.bak" + if [[ ! -f "$backup_filename" ]]; then + echo "Backup file not found: $backup_filename" + return 1 + fi + + # Replace the modified file with the backup + mv -v "$backup_filename" "$filename" +} + +# Collect big enum files +for protofile in `find ${PROTO_DIR} -type f -name '*.proto'`; do + if [[ ${BIG_ENUMS[@]} =~ $(basename ${protofile}) ]]; then + # Found a big enum, add to TRUNCATE + TRUNCATE+=(${protofile}) + # Then truncate the file + shorten_protobuf ${protofile} + fi +done + +# Generate diagrams +for protofile in `find ${PROTO_DIR} -type f -name '*.proto'`; do + # Set proto file dir + protofile_dir=${GENERATED_DIR}/${PROTODOT_DIR}/$(dirname ${protofile}) + + # Create proto file dir if it doesn't exist + mkdir -p ${protofile_dir} + + # Create the protodot diagram + ${PROTODOT} -generated ${protofile_dir} -src ${protofile} -output $(basename ${protofile}) + + # Create a scaled version of the diagram + svg_filename="${GENERATED_DIR}/${PROTODOT_DIR}/${protofile}.dot.svg" + xs_filename="${GENERATED_DIR}/${PROTODOT_DIR}/${protofile}.dot.xs.svg" + rsvg-convert "${svg_filename}" -w 850 -f svg -o "${xs_filename}" +done + +# When generating finished, revert the truncated big enums +for truncated_file in "${TRUNCATE[@]}"; do + # Revert the truncated files back + revert_protobuf ${truncated_file} +done \ No newline at end of file diff --git a/scripts/insert_diagram_link.sh b/scripts/insert_diagram_link.sh new file mode 100755 index 00000000..3cb35955 --- /dev/null +++ b/scripts/insert_diagram_link.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Directory to search +directory="proto" + +# Process each .proto file found +find "$directory" -type f -name "*.proto" | while read -r proto_file; do + awk ' + !inserted && /^enum|^message/ { + gsub(/\/path\/to\/directory\//, "", FILENAME) # Remove the base directory path + print "// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/" FILENAME ".dot.xs.svg)" + print "// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/" FILENAME ".dot.svg)" + inserted=1 + } + { print } + ' "$proto_file" > temp_file && mv -v temp_file "$proto_file" +done