// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.maps.places.v1;

import "google/api/field_behavior.proto";
import "google/geo/type/viewport.proto";
import "google/protobuf/timestamp.proto";
import "google/type/date.proto";
import "google/type/latlng.proto";
import "google/type/localized_text.proto";

option cc_enable_arenas = true;
option csharp_namespace = "Google.Maps.Places.V1";
option go_package = "cloud.google.com/go/maps/places/apiv1/placespb;placespb";
option java_multiple_files = true;
option java_outer_classname = "PlaceProto";
option java_package = "com.google.maps.places.v1";
option objc_class_prefix = "GMPSV1";
option php_namespace = "Google\\Maps\\Places\\V1";

// All the information representing a Place.
message Place {
  // The structured components that form the formatted address, if this
  // information is available.
  message AddressComponent {
    // The full text description or name of the address component. For example,
    // an address component for the country Australia may have a long_name of
    // "Australia".
    string long_text = 1;

    // An abbreviated textual name for the address component, if available. For
    // example, an address component for the country of Australia may have a
    // short_name of "AU".
    string short_text = 2;

    // An array indicating the type(s) of the address component.
    repeated string types = 3;

    // The language used to format this components, in CLDR notation.
    string language_code = 4;
  }

  // Plus code (http://plus.codes) is a location reference with two formats:
  // global code defining a 14mx14m (1/8000th of a degree) or smaller rectangle,
  // and compound code, replacing the prefix with a reference location.
  message PlusCode {
    // Place's global (full) code, such as `9FWM33GV+HQ`, representing an
    // 1/8000 by 1/8000 degree area (~14 by 14 meters).
    string global_code = 1;

    // Place's compound code, such as `33GV+HQ, Ramberg, Norway`, containing
    // the suffix of the global code and replacing the prefix with a formatted
    // name of a reference entity.
    string compound_code = 2;
  }

  // Information about a review of the place.
  message Review {
    // Timestamp for the review, expressed in seconds since epoch.
    google.protobuf.Timestamp publish_time = 1;

    // A string of formatted recent time, expressing the review time relative
    // to the current time in a form appropriate for the language and country.
    string relative_publish_time_description = 2;

    // The localized text of the review.
    google.type.LocalizedText text = 9;

    // The name of the review author.
    string author = 4;

    // A link to the review author's profile.
    string author_uri = 5;

    // The author's profile photo.
    string author_photo_uri = 6;

    // A whole number between 1.0 and 5.0, a.k.a. the number of stars.
    double rating = 7;

    // A BCP-47 language code indicating the original language of the review.
    // If the review has been translated, then original_language != language.
    // This field contains the main language tag only, and not the secondary tag
    // indicating country or region. For example, all the English reviews are
    // tagged as 'en', and not 'en-AU' or 'en-UK' and so on.This field is empty
    // if there is only a rating with no review text.
    string original_language_code = 10;

    // A boolean value indicating if the review was translated from the original
    // language it was written in. If a review has been translated,
    // corresponding to a value of true, Google recommends that you indicate
    // this to your users. For example, you can add the following string,
    // “Translated by Google”, to the review.
    bool translated = 11;
  }

  // Information about business hour of the place.
  message OpeningHours {
    // A period the place remains in open_now status.
    message OpeningHoursPeriod {
      // Status changing points.
      message OpeningHoursPoint {
        // A day of the week, as an integer in the range 0-6.  0 is Sunday, 1 is
        // Monday, etc.
        optional int32 day = 1;

        // The hour in 2 digits. Ranges from 00 to 23.
        optional int32 hour = 2;

        // The minute in 2 digits. Ranges from 00 to 59.
        optional int32 minute = 3;

        // Date of the endpoint expressed in `RFC3339` format in the local
        // timezone for the place. For example 2010-12-31.
        string date_deprecated = 4 [deprecated = true];

        // Date in the local timezone for the place.
        google.type.Date date = 6;

        // Whether or not this endpoint was truncated. Truncation occurs when
        // the real hours are outside the times we are willing to return hours
        // between, so we truncate the hours back to these boundaries. This
        // ensures that at most `24 * 7` hours from midnight of the day of the
        // request are returned.
        bool truncated = 5;
      }

      // The time that the place starts to be open.
      OpeningHoursPoint open = 1;

      // The time that the place starts to be closed.
      OpeningHoursPoint close = 2;
    }

    // A type used to identify the type of secondary hours.
    enum SecondaryHourType {
      // Default value when secondary hour type is not specified.
      SECONDARY_HOUR_TYPE_UNSPECIFIED = 0;

      // The drive-through hour for banks, restaurants, or pharmacies.
      DRIVE_THROUGH = 1;

      // The happy hour.
      HAPPY_HOUR = 2;

      // The delivery hour.
      DELIVERY = 3;

      // The takeout hour.
      TAKEOUT = 4;

      // The kitchen hour.
      KITCHEN = 5;

      // The breakfast hour.
      BREAKFAST = 6;

      // The lunch hour.
      LUNCH = 7;

      // The dinner hour.
      DINNER = 8;

      // The brunch hour.
      BRUNCH = 9;

      // The pickup hour.
      PICKUP = 10;

      // The access hours for storage places.
      ACCESS = 11;

      // The special hours for seniors.
      SENIOR_HOURS = 12;

      // The online service hours.
      ONLINE_SERVICE_HOURS = 13;
    }

    // Structured information for special days that fall within the period that
    // the returned opening hours cover. Special days are days that could impact
    // the business hours of a place, e.g. Christmas day.
    message SpecialDay {
      // The date of this special day.
      google.type.Date date = 1;
    }

    // Is this place open right now?  Always present unless we lack time-of-day
    // or timezone data for these opening hours.
    bool open_now = 1;

    // The periods that this place is open during the week. The periods are in
    // chronological order, starting with Sunday in the place-local timezone. An
    // empty (but not absent) value indicates a place that is never open, e.g.
    // because it is closed temporarily for renovations.
    repeated OpeningHoursPeriod periods = 2;

    // Localized strings describing the opening hours of this place, one string
    // for each day of the week.  Will be empty if the hours are unknown or
    // could not be converted to localized text. Example: "Sun: 18:00–06:00"
    repeated string weekday_descriptions = 3;

    // A type string used to identify the type of secondary hours.
    SecondaryHourType secondary_hour_type = 4;

    // Structured information for special days that fall within the period that
    // the returned opening hours cover. Special days are days that could impact
    // the business hours of a place, e.g. Christmas day. Set for
    // current_opening_hours and current_secondary_opening_hours if there are
    // exceptional hours.
    repeated SpecialDay special_days = 5;
  }

  // Business status for the place.
  enum BusinessStatus {
    // Default value. This value is unused.
    BUSINESS_STATUS_UNSPECIFIED = 0;

    // The establishment is operational, not necessarily open now.
    OPERATIONAL = 1;

    // The establishment is temporarily closed.
    CLOSED_TEMPORARILY = 2;

    // The establishment is permanently closed.
    CLOSED_PERMANENTLY = 3;
  }

  // Information about data providers of this place.
  message Attribution {
    // Name of the Place's data provider.
    string provider = 1;

    // URI to the Place's data provider.
    string provider_uri = 2;
  }

  // Contains a summary of the place.
  message EditorialSummary {
    // A summary is comprised of a textual overview, and also includes the
    // language code for these if applicable. Summary text must be presented
    // as-is and can not be modified or altered.
    google.type.LocalizedText overview = 1;
  }

  // Required. The unique identifier of a place.
  string id = 2 [(google.api.field_behavior) = REQUIRED];

  // The localized name of the place, suitable as a short human-readable
  // description. For example, "Google Sydney", "Starbucks", "Pyrmont", etc.
  google.type.LocalizedText display_name = 31;

  // A set of type tags for this result. For example, "political" and
  // "locality".
  repeated string types = 5;

  // A human-readable phone number for the place, in national format.
  string national_phone_number = 7;

  // A human-readable phone number for the place, in international format.
  string international_phone_number = 8;

  // A full, human-readable address for this place.
  string formatted_address = 9;

  // Repeated components for each locality level.
  repeated AddressComponent address_components = 10;

  // Plus code of the place location lat/long.
  PlusCode plus_code = 11;

  // The position of this place.
  google.type.LatLng location = 12;

  // A viewport suitable for displaying the place on an average-sized map.
  google.geo.type.Viewport viewport = 13;

  // A rating between 1.0 and 5.0, based on user reviews of this place.
  double rating = 14;

  // A URL providing more information about this place.
  string google_maps_uri = 15;

  // The authoritative website for this place, e.g. a business' homepage.
  // Note that for places that are part of a chain (e.g. an IKEA store), this
  // will usually be the website for the individual store, not the overall
  // chain.
  string website_uri = 16;

  // List of reviews about this place.
  repeated Review reviews = 20;

  // The regular hours of operation.
  OpeningHours opening_hours = 21;

  // Number of minutes this place's timezone is currently offset from UTC.
  // This is expressed in minutes to support timezones that are offset by
  // fractions of an hour, e.g. X hours and 15 minutes.
  int32 utc_offset_minutes = 22;

  // The place's address in adr microformat: http://microformats.org/wiki/adr.
  string adr_format_address = 24;

  // The business status for the place.
  BusinessStatus business_status = 25;

  // Price level of the place.
  PriceLevel price_level = 26;

  // A set of data provider that must be shown with this result.
  repeated Attribution attributions = 27;

  // The total number of reviews (with or without text) for this place.
  int32 user_rating_count = 28;

  // A truncated URL to an v2 icon mask. User can access different icon type by
  // appending type suffix to the end (eg, ".svg" or ".png").
  string icon_mask_base_uri = 29;

  // Background color for icon_mask in hex format, e.g. #909CE1.
  string icon_background_color = 30;

  // Specifies if the business supports takeout.
  optional bool takeout = 33;

  // Specifies if the business supports delivery.
  optional bool delivery = 34;

  // Specifies if the business supports indoor or outdoor seating options.
  optional bool dine_in = 35;

  // Specifies if the business supports curbside pickup.
  optional bool curbside_pickup = 36;

  // Specifies if the place has an entrance that is wheelchair-accessible.
  optional bool wheelchair_accessible_entrance = 37;

  // Specifies if the place supports reservations.
  optional bool reservable = 38;

  // Specifies if the place serves breakfast.
  optional bool serves_breakfast = 39;

  // Specifies if the place serves lunch.
  optional bool serves_lunch = 40;

  // Specifies if the place serves dinner.
  optional bool serves_dinner = 41;

  // Specifies if the place serves beer.
  optional bool serves_beer = 42;

  // Specifies if the place serves wine.
  optional bool serves_wine = 43;

  // Specifies if the place serves brunch.
  optional bool serves_brunch = 44;

  // Specifies if the place serves vegetarian food.
  optional bool serves_vegetarian_food = 45;

  // The hours of operation for the next seven days (including today). The time
  // period starts at midnight on the date of the request and ends at 11:59 pm
  // six days later. This field includes the special_days subfield of all hours,
  // set for dates that have exceptional hours.
  OpeningHours current_opening_hours = 46;

  // Contains an array of entries for the next seven days including information
  // about secondary hours of a business. Secondary hours are different from a
  // business's main hours. For example, a restaurant can specify drive through
  // hours or delivery hours as its secondary hours. This field populates the
  // type subfield, which draws from a predefined list of opening hours types
  // (such as DRIVE_THROUGH, PICKUP, or TAKEOUT) based on the types of the
  // place. This field includes the special_days subfield of all hours, set for
  // dates that have exceptional hours.
  repeated OpeningHours current_secondary_opening_hours = 47;

  // Contains an array of entries for information about regular secondary hours
  // of a business. Secondary hours are different from a business's main hours.
  // For example, a restaurant can specify drive through hours or delivery hours
  // as its secondary hours. This field populates the type subfield, which draws
  // from a predefined list of opening hours types (such as DRIVE_THROUGH,
  // PICKUP, or TAKEOUT) based on the types of the place.
  repeated OpeningHours secondary_opening_hours = 49;

  // Contains a summary of the place. A summary is comprised of a textual
  // overview, and also includes the language code for these if applicable.
  // Summary text must be presented as-is and can not be modified or altered.
  EditorialSummary editorial_summary = 48;
}

// Price level of the place.
enum PriceLevel {
  // Place price level is unspecified or unknown.
  PRICE_LEVEL_UNSPECIFIED = 0;

  FREE = 1;

  // Place provides inexpensive services.
  INEXPENSIVE = 2;

  // Place provides moderately priced services.
  MODERATE = 3;

  // Place provides expensive services.
  EXPENSIVE = 4;

  // Place provides very expensive services.
  VERY_EXPENSIVE = 5;
}
