// This file is @generated by prost-build.
/// A trip.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Trip {
    /// Output only. Identifier. The resource name of the trip.
    /// Format: projects/{project_number}/trips/{trip_id}.
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// Immutable. The configuration for the trip.
    #[prost(message, optional, tag = "7")]
    pub config: ::core::option::Option<TripConfig>,
    /// Input only. Immutable. The Android application ID of the mobile application
    /// that will use the trip. At least one of `android_app_id` or `ios_app_id`
    /// must be set.
    #[prost(string, tag = "8")]
    pub android_app_id: ::prost::alloc::string::String,
    /// Input only. Immutable. The iOS bundle ID of the mobile application that
    /// will use the trip. At least one of `android_app_id` or `ios_app_id` must be
    /// set.
    #[prost(string, tag = "9")]
    pub ios_app_id: ::prost::alloc::string::String,
    /// Output only. An opaque token that authorizes access to begin a NavConnect
    /// trip in Google Maps or Waze and grants these applications access to update
    /// the trip. Only returned by `CreateTrip`.
    #[prost(message, optional, tag = "2")]
    pub auth_token: ::core::option::Option<AuthToken>,
    /// Output only. The Trip state.
    #[prost(enumeration = "trip::State", tag = "3")]
    pub state: i32,
    /// Output only. The latest data about the execution of the trip. This may not
    /// be set if the trip is in an error state.
    #[prost(message, optional, tag = "4")]
    pub execution: ::core::option::Option<TripExecution>,
    /// Output only. Time according to the server when the trip was created.
    #[prost(message, optional, tag = "5")]
    pub create_time: ::core::option::Option<::prost_types::Timestamp>,
    /// Output only. Time at which the server received the latest trip update.
    #[prost(message, optional, tag = "6")]
    pub update_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// Nested message and enum types in `Trip`.
pub mod trip {
    /// All possible trip states.
    #[derive(
        Clone,
        Copy,
        Debug,
        PartialEq,
        Eq,
        Hash,
        PartialOrd,
        Ord,
        ::prost::Enumeration
    )]
    #[repr(i32)]
    pub enum State {
        /// The trip state is unspecified.
        Unspecified = 0,
        /// The trip was created but has not yet started.
        New = 1,
        /// The transporter is enroute to the destination.
        Enroute = 2,
        /// The transporter arrived at the destination.
        Arrived = 3,
        /// The trip was suspended.
        Suspended = 4,
        /// The trip failed to complete successfully.
        Failed = 5,
        /// The trip failed due to a client error.
        ClientError = 6,
    }
    impl State {
        /// String value of the enum field names used in the ProtoBuf definition.
        ///
        /// The values are not transformed in any way and thus are considered stable
        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
        pub fn as_str_name(&self) -> &'static str {
            match self {
                Self::Unspecified => "STATE_UNSPECIFIED",
                Self::New => "NEW",
                Self::Enroute => "ENROUTE",
                Self::Arrived => "ARRIVED",
                Self::Suspended => "SUSPENDED",
                Self::Failed => "FAILED",
                Self::ClientError => "CLIENT_ERROR",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "STATE_UNSPECIFIED" => Some(Self::Unspecified),
                "NEW" => Some(Self::New),
                "ENROUTE" => Some(Self::Enroute),
                "ARRIVED" => Some(Self::Arrived),
                "SUSPENDED" => Some(Self::Suspended),
                "FAILED" => Some(Self::Failed),
                "CLIENT_ERROR" => Some(Self::ClientError),
                _ => None,
            }
        }
    }
}
/// Configuration for the trip.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TripConfig {
    /// Optional. Whether to enable high frequency trip updates.
    ///
    /// NOTE: Enabling this feature logs the trip under Enterprise Tier usage, and
    /// is subject to Enterprise Tier rates.
    #[prost(bool, tag = "1")]
    pub enable_high_frequency_updates: bool,
    /// Optional. Whether to enable pubsub notifications for the trip.
    #[prost(bool, tag = "2")]
    pub enable_pubsub: bool,
    /// Optional. If set, only the specified subset of the Trip fields will be
    /// included in the pubsub notifications.
    ///
    /// If not set, all Trip fields will be included in the pubsub notifications
    /// (default behavior).
    ///
    /// The following fields are not supported:
    ///
    /// * `android_app_id`
    /// * `ios_app_id`
    /// * `auth_token`
    /// * `config`
    ///
    /// NOTE: This field is ignored if `enable_pubsub` is false.
    #[prost(message, optional, tag = "3")]
    pub pubsub_field_mask: ::core::option::Option<::prost_types::FieldMask>,
}
/// An authentication token.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthToken {
    /// Output only. The authentication token that should be passed to the mobile
    /// application.
    #[prost(string, tag = "1")]
    pub token: ::prost::alloc::string::String,
    /// Output only. Time at which the authentication token will expire.
    #[prost(message, optional, tag = "2")]
    pub expire_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// Data about the execution of the trip.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TripExecution {
    /// Output only. Origin of the trip which is generally the transporter's
    /// location at start of the NavConnect trip.
    #[prost(message, optional, tag = "1")]
    pub origin: ::core::option::Option<Location>,
    /// Output only. The destination of the trip as reported by the mobile
    /// application.
    #[prost(message, optional, tag = "2")]
    pub destination: ::core::option::Option<Stop>,
    /// Output only. The location signal representing the last known location of
    /// the transporter. This will be the road snapped location if available.
    #[prost(message, optional, tag = "3")]
    pub location: ::core::option::Option<Location>,
    /// Output only. Time traveled thus far.
    #[prost(message, optional, tag = "4")]
    pub traveled_duration: ::core::option::Option<::prost_types::Duration>,
    /// Output only. Time left on this trip as estimated by Google.
    #[prost(message, optional, tag = "5")]
    pub remaining_duration: ::core::option::Option<::prost_types::Duration>,
    /// Output only. Distance traveled from the origin in meters.
    #[prost(int32, optional, tag = "6")]
    pub traveled_distance_meters: ::core::option::Option<i32>,
    /// Output only. Distance remaining to the destination in meters.
    #[prost(int32, optional, tag = "7")]
    pub remaining_distance_meters: ::core::option::Option<i32>,
    /// Output only. Indicates whether a stop was added along the route.
    #[prost(bool, optional, tag = "8")]
    pub stop_added_in_route: ::core::option::Option<bool>,
}
/// A stop in the trip where some task is to be performed.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Stop {
    /// Required. The location of the stop as a lat/lng.
    #[prost(message, optional, tag = "1")]
    pub point: ::core::option::Option<super::super::super::r#type::LatLng>,
}
/// A location as reported by the mobile application.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Location {
    /// Output only. The location lat/lng.
    #[prost(message, optional, tag = "1")]
    pub point: ::core::option::Option<super::super::super::r#type::LatLng>,
    /// Output only. The time when the location was sourced as denoted by the
    /// client.
    #[prost(message, optional, tag = "2")]
    pub source_time: ::core::option::Option<::prost_types::Timestamp>,
    /// Output only. The time at which the server received this location update.
    #[prost(message, optional, tag = "3")]
    pub server_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// Request message for NavConnectService.CreateTrip.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateTripRequest {
    /// Required. The parent resource under which this trip will be created.
    /// Format: projects/{project_number}
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// Required. The ID to use for the trip, which will become the final component
    /// of the trip's resource name.
    ///
    /// This value must be a valid RFC-4122 UUID.
    #[prost(string, tag = "2")]
    pub trip_id: ::prost::alloc::string::String,
    /// Required. The trip to create.
    #[prost(message, optional, tag = "3")]
    pub trip: ::core::option::Option<Trip>,
}
/// Request message for NavConnectService.GetTrip.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetTripRequest {
    /// Required. The resource name of the trip to get.
    /// Format: projects/{project}/trips/{trip_id}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod nav_connect_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// Service for NavConnect clients to create and get trips.
    #[derive(Debug, Clone)]
    pub struct NavConnectServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl NavConnectServiceClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> NavConnectServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> NavConnectServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            NavConnectServiceClient::new(InterceptedService::new(inner, interceptor))
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        /// Creates a trip. This must be called before the mobile application can start
        /// the trip. The returned trip will have the `auth_token` field set.
        pub async fn create_trip(
            &mut self,
            request: impl tonic::IntoRequest<super::CreateTripRequest>,
        ) -> std::result::Result<tonic::Response<super::Trip>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.maps.navconnect.v1.NavConnectService/CreateTrip",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.maps.navconnect.v1.NavConnectService",
                        "CreateTrip",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Gets a trip.
        pub async fn get_trip(
            &mut self,
            request: impl tonic::IntoRequest<super::GetTripRequest>,
        ) -> std::result::Result<tonic::Response<super::Trip>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.maps.navconnect.v1.NavConnectService/GetTrip",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.maps.navconnect.v1.NavConnectService",
                        "GetTrip",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
