// Copyright 2026 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/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "google/type/latlng.proto";
import "google/type/localized_text.proto";

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 = "TransitProto";
option java_package = "com.google.maps.places.v1";
option objc_class_prefix = "GMPSV1";
option php_namespace = "Google\\Maps\\Places\\V1";

// Represents transit-specific information for a place.
message TransitStation {
  // The name of the station in the local language.
  google.type.LocalizedText display_name = 1;

  // The transit agencies that serve this station.
  repeated TransitAgency agencies = 2;

  // Transit stops at this station.
  repeated TransitStop stops = 3;
}

// Represents a transit agency.
message TransitAgency {
  // Agency name (e.g. "VTA") in the requested language.
  google.type.LocalizedText display_name = 1;

  // The URL of the agency's homepage.
  string url = 2;

  // The URL of the agency's fare details page.
  string fare_url = 3;

  // Icon identifier for localized branded icon of a transit system (e.g. London
  // Underground) which should be used instead of TransitLine.vehicle_icon in
  // the UI.
  TransitIcon icon = 4;

  // The transit lines that are served by this agency.
  repeated TransitLine lines = 5;
}

// Represents a single transit line.
message TransitLine {
  // The id of the transit line that can be used to uniquely identify the line
  // among other transit lines in the same transit station. This identifier is
  // not guaranteed to be stable across different responses.
  string id = 1;

  // The type of vehicle for a transit line.
  enum VehicleType {
    // Default value when vehicle type is not specified.
    VEHICLE_TYPE_UNSPECIFIED = 0;

    // Rail.
    RAIL = 1;

    // Metro rail.
    METRO_RAIL = 2;

    // Subway.
    SUBWAY = 3;

    // Tram.
    TRAM = 4;

    // Monorail.
    MONORAIL = 5;

    // Heavy rail.
    HEAVY_RAIL = 6;

    // Commuter train.
    COMMUTER_TRAIN = 7;

    // High speed train.
    HIGH_SPEED_TRAIN = 8;

    // Long distance train.
    LONG_DISTANCE_TRAIN = 9;

    // Bus.
    BUS = 10;

    // Intercity bus.
    INTERCITY_BUS = 11;

    // Trolleybus.
    TROLLEYBUS = 12;

    // Share taxi.
    SHARE_TAXI = 13;

    // Coach.
    COACH = 14;

    // Ferry.
    FERRY = 15;

    // Cable car.
    CABLE_CAR = 16;

    // Gondola lift.
    GONDOLA_LIFT = 17;

    // Funicular.
    FUNICULAR = 18;

    // Special.
    SPECIAL = 19;

    // Horse carriage.
    HORSE_CARRIAGE = 20;

    // Airplane.
    AIRPLANE = 21;
  }

  // The type of vehicle using this line.
  VehicleType vehicle_type = 2;

  // The long name for this transit line (e.g. "Sunnydale local").
  google.type.LocalizedText display_name = 3;

  // The short name for this transit line (e.g. "S2").
  google.type.LocalizedText short_display_name = 4;

  // The text color of labels for this transit line in #RRGGBB hex format,
  // e.g. #909CE1.
  string text_color = 5;

  // The background color of the labels for this transit line in #RRGGBB hex
  // format, e.g. #909CE1. This color can also be used for drawing shapes for
  // this transit line.
  string background_color = 6;

  // The URL of a webpage with details about this line.
  string url = 7;

  // Icon identifier for this particular line (e.g. subway lines in New York).
  TransitIcon icon = 8;

  // Icon identifier for this particular vehicle type.
  TransitIcon vehicle_icon = 9;
}

// Represents a transit stop within a station. This is a specific location
// where passengers board and alight transit vehicles, such as a platform or
// bus bay. This is distinct from a `Departure`, which is an event of a vehicle
// leaving a stop at a specific time.
message TransitStop {
  // The id of the transit stop that can be used to uniquely identify the stop
  // among other transit stops in the same transit station. This identifier is
  // not guaranteed to be stable across different responses.
  string id = 1;

  // The name of the stop.
  google.type.LocalizedText display_name = 2;

  // The platform code represented by this stop. It can be formatted in any way.
  // (eg: "2", "Platform 2", "2-4", or "1x").
  google.type.LocalizedText platform_code = 3;

  // The verbatim text written on the signboard for this platform, e.g. "Towards
  // Central" or "East side & Brooklyn". When `platform_code` is absent, this
  // field is potentially the only identifier for the platform; however, both
  // `platform_code` and `signage_text` may be set simultaneously.
  google.type.LocalizedText signage_text = 4;

  // Human readable identifier of the stop, used by transit agencies to
  // distinguish stops with the same name.
  google.type.LocalizedText stop_code = 5;

  // The stop's location.
  google.type.LatLng location = 6;

  // Wheelchair accessibility of this stop. This field indicates whether there
  // is an accessible path from outside the station to the stop. It does not
  // indicate whether it is possible to board a vehicle from the stop.
  optional bool wheelchair_accessible_entrance = 7;
}

// Icon for a transit line, vehicle, or agency.
message TransitIcon {
  // The URL of the icon.
  string url = 1;

  // Whether the name is contained in the icon and there is no need to display
  // it next to the icon.
  bool name_included = 2;
}
