// This file is @generated by prost-build.
/// Signals only can be created but not updated.
/// Businesses need to call this API only when the order is completely shipped.
/// Creates new order signal.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateOrderTrackingSignalRequest {
    /// Required. The account of the business for which the order signal is
    /// created. Format: accounts/{account}
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// Output only. The ID that uniquely identifies this order tracking signal.
    #[prost(string, tag = "2")]
    pub order_tracking_signal_id: ::prost::alloc::string::String,
    /// Required. The order signal to be created.
    #[prost(message, optional, tag = "3")]
    pub order_tracking_signal: ::core::option::Option<OrderTrackingSignal>,
}
/// Represents a business trade from which signals are extracted, such as
/// shipping.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OrderTrackingSignal {
    /// Output only. The ID that uniquely identifies this order tracking signal.
    #[prost(int64, tag = "11")]
    pub order_tracking_signal_id: i64,
    /// Optional. The Google Merchant Center ID of this order tracking signal. This
    /// value is optional. If left unset, the caller's Merchant Center ID is used.
    /// You must request access in order to provide data on behalf of another
    /// business. For more information, see [Submitting Order Tracking
    /// Signals](/shopping-content/guides/order-tracking-signals).
    #[prost(int64, tag = "12")]
    pub merchant_id: i64,
    /// Required. The time when the order was created on the businesses side.
    /// Include the year and timezone string, if available.
    #[prost(message, optional, tag = "1")]
    pub order_created_time: ::core::option::Option<
        super::super::super::super::r#type::DateTime,
    >,
    /// Required. The ID of the order on the businesses side. This field will be
    /// hashed in returned OrderTrackingSignal creation response.
    #[prost(string, tag = "2")]
    pub order_id: ::prost::alloc::string::String,
    /// Required. The shipping information for the order.
    #[prost(message, repeated, tag = "3")]
    pub shipping_info: ::prost::alloc::vec::Vec<order_tracking_signal::ShippingInfo>,
    /// Required. Information about line items in the order.
    #[prost(message, repeated, tag = "4")]
    pub line_items: ::prost::alloc::vec::Vec<order_tracking_signal::LineItemDetails>,
    /// Optional. The mapping of the line items to the shipment information.
    #[prost(message, repeated, tag = "5")]
    pub shipment_line_item_mapping: ::prost::alloc::vec::Vec<
        order_tracking_signal::ShipmentLineItemMapping,
    >,
    /// Optional. The shipping fee of the order;
    /// this value should be set to zero in the case of free shipping.
    #[prost(message, optional, tag = "6")]
    pub customer_shipping_fee: ::core::option::Option<
        super::super::super::r#type::Price,
    >,
    /// Optional. The delivery postal code, as a continuous string without spaces
    /// or dashes, for example "95016". This field will be anonymized in returned
    /// OrderTrackingSignal creation response.
    #[prost(string, tag = "9")]
    pub delivery_postal_code: ::prost::alloc::string::String,
    /// Optional. The \[CLDR territory code\]
    /// (<http://www.unicode.org/repos/cldr/tags/latest/common/main/en.xml>) for
    /// the shipping destination.
    #[prost(string, tag = "10")]
    pub delivery_region_code: ::prost::alloc::string::String,
}
/// Nested message and enum types in `OrderTrackingSignal`.
pub mod order_tracking_signal {
    /// The shipping information for the order.
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct ShippingInfo {
        /// Required. The shipment ID. This field will be hashed in returned
        /// OrderTrackingSignal creation response.
        #[prost(string, tag = "1")]
        pub shipment_id: ::prost::alloc::string::String,
        /// Optional. The tracking ID of the shipment. This field is required if one
        /// of the following fields is absent: earliest_delivery_promise_time,
        /// latest_delivery_promise_time, and actual_delivery_time.
        #[prost(string, tag = "2")]
        pub tracking_id: ::prost::alloc::string::String,
        /// Optional. The name of the shipping carrier for the delivery. This field
        /// is required if one of the following fields is absent:
        /// earliest_delivery_promise_time, latest_delivery_promise_time,
        /// and actual_delivery_time.
        #[prost(string, tag = "3")]
        pub carrier: ::prost::alloc::string::String,
        /// Optional. The service type for fulfillment, such as GROUND, FIRST_CLASS,
        /// etc.
        #[prost(string, tag = "4")]
        pub carrier_service: ::prost::alloc::string::String,
        /// Optional. The time when the shipment was shipped.
        /// Include the year and timezone string, if available.
        #[prost(message, optional, tag = "5")]
        pub shipped_time: ::core::option::Option<
            super::super::super::super::super::r#type::DateTime,
        >,
        /// Optional. The earliest delivery promised time.
        /// Include the year and timezone string, if available.
        /// This field is required, if one of the following fields is absent:
        /// tracking_id or carrier_name.
        #[prost(message, optional, tag = "6")]
        pub earliest_delivery_promise_time: ::core::option::Option<
            super::super::super::super::super::r#type::DateTime,
        >,
        /// Optional. The latest delivery promised time.
        /// Include the year and timezone string, if available.
        /// This field is required, if one of the following fields is absent:
        /// tracking_id or carrier_name.
        #[prost(message, optional, tag = "7")]
        pub latest_delivery_promise_time: ::core::option::Option<
            super::super::super::super::super::r#type::DateTime,
        >,
        /// Optional. The time when the shipment was actually delivered.
        /// Include the year and timezone string, if available.
        /// This field is required, if one of the following fields is absent:
        /// tracking_id or carrier_name.
        #[prost(message, optional, tag = "8")]
        pub actual_delivery_time: ::core::option::Option<
            super::super::super::super::super::r#type::DateTime,
        >,
        /// Required. The status of the shipment.
        #[prost(enumeration = "shipping_info::ShippingState", tag = "9")]
        pub shipping_status: i32,
        /// Required. The origin postal code, as a continuous string without spaces
        /// or dashes, for example "95016". This field will be anonymized in returned
        /// OrderTrackingSignal creation response.
        #[prost(string, tag = "10")]
        pub origin_postal_code: ::prost::alloc::string::String,
        /// Required. The \[CLDR territory code\]
        /// (<http://www.unicode.org/repos/cldr/tags/latest/common/main/en.xml>) for
        /// the shipping origin.
        #[prost(string, tag = "11")]
        pub origin_region_code: ::prost::alloc::string::String,
    }
    /// Nested message and enum types in `ShippingInfo`.
    pub mod shipping_info {
        /// The current status of the shipments.
        #[derive(
            Clone,
            Copy,
            Debug,
            PartialEq,
            Eq,
            Hash,
            PartialOrd,
            Ord,
            ::prost::Enumeration
        )]
        #[repr(i32)]
        pub enum ShippingState {
            /// The shipping status is not known to business.
            Unspecified = 0,
            /// All items are shipped.
            Shipped = 1,
            /// The shipment is already delivered.
            Delivered = 2,
        }
        impl ShippingState {
            /// 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 => "SHIPPING_STATE_UNSPECIFIED",
                    Self::Shipped => "SHIPPED",
                    Self::Delivered => "DELIVERED",
                }
            }
            /// Creates an enum from field names used in the ProtoBuf definition.
            pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
                match value {
                    "SHIPPING_STATE_UNSPECIFIED" => Some(Self::Unspecified),
                    "SHIPPED" => Some(Self::Shipped),
                    "DELIVERED" => Some(Self::Delivered),
                    _ => None,
                }
            }
        }
    }
    /// The line items of the order.
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct LineItemDetails {
        /// Required. The ID for this line item.
        #[prost(string, tag = "1")]
        pub line_item_id: ::prost::alloc::string::String,
        /// Required. The Content API REST ID of the product, in the
        /// form channel:contentLanguage:targetCountry:offerId.
        #[prost(string, tag = "2")]
        pub product_id: ::prost::alloc::string::String,
        /// Optional. The Global Trade Item Numbers.
        #[prost(string, repeated, tag = "8")]
        pub gtins: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
        /// Optional. The manufacturer part number.
        #[prost(string, tag = "4")]
        pub mpn: ::prost::alloc::string::String,
        /// Optional. Plain text title of this product.
        #[prost(string, optional, tag = "5")]
        pub product_title: ::core::option::Option<::prost::alloc::string::String>,
        /// Optional. Brand of the product.
        #[prost(string, optional, tag = "6")]
        pub brand: ::core::option::Option<::prost::alloc::string::String>,
        /// Required. The quantity of the line item in the order.
        #[prost(int64, tag = "7")]
        pub quantity: i64,
    }
    /// Represents how many items are in the shipment for the given shipment_id
    /// and line_item_id.
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct ShipmentLineItemMapping {
        /// Required. The shipment ID. This field will be hashed in returned
        /// OrderTrackingSignal creation response.
        #[prost(string, tag = "1")]
        pub shipment_id: ::prost::alloc::string::String,
        /// Required. The line item ID.
        #[prost(string, tag = "2")]
        pub line_item_id: ::prost::alloc::string::String,
        /// Required. The line item quantity in the shipment.
        #[prost(int64, tag = "3")]
        pub quantity: i64,
    }
}
/// Generated client implementations.
pub mod order_tracking_signals_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 to serve order tracking signals public API.
    #[derive(Debug, Clone)]
    pub struct OrderTrackingSignalsServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl OrderTrackingSignalsServiceClient<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> OrderTrackingSignalsServiceClient<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,
        ) -> OrderTrackingSignalsServiceClient<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,
        {
            OrderTrackingSignalsServiceClient::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 new order tracking signal.
        pub async fn create_order_tracking_signal(
            &mut self,
            request: impl tonic::IntoRequest<super::CreateOrderTrackingSignalRequest>,
        ) -> std::result::Result<
            tonic::Response<super::OrderTrackingSignal>,
            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.shopping.merchant.ordertracking.v1.OrderTrackingSignalsService/CreateOrderTrackingSignal",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.shopping.merchant.ordertracking.v1.OrderTrackingSignalsService",
                        "CreateOrderTrackingSignal",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
