// This file is @generated by prost-build.
/// A resource message representing a Google Marketing Platform organization.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Organization {
    /// Identifier. The resource name of the GMP organization.
    /// Format: organizations/{org_id}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// The human-readable name for the organization.
    #[prost(string, tag = "2")]
    pub display_name: ::prost::alloc::string::String,
}
/// A resource message representing the link between a Google Analytics account
/// and a Google Marketing Platform organization.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AnalyticsAccountLink {
    /// Identifier. Resource name of this AnalyticsAccountLink. Note the resource
    /// ID is the same as the ID of the Analtyics account.
    ///
    /// Format:
    /// organizations/{org_id}/analyticsAccountLinks/{analytics_account_link_id}
    /// Example: "organizations/xyz/analyticsAccountLinks/1234"
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// Required. Immutable. The resource name of the AnalyticsAdmin API account.
    /// The account ID will be used as the ID of this AnalyticsAccountLink
    /// resource, which will become the final component of the resource name.
    ///
    /// Format: analyticsadmin.googleapis.com/accounts/{account_id}
    #[prost(string, tag = "2")]
    pub analytics_account: ::prost::alloc::string::String,
    /// Output only. The human-readable name for the Analytics account.
    #[prost(string, tag = "3")]
    pub display_name: ::prost::alloc::string::String,
    /// Output only. The verification state of the link between the Analytics
    /// account and the parent organization.
    #[prost(enumeration = "LinkVerificationState", tag = "4")]
    pub link_verification_state: i32,
}
/// The verification state of the link between a product account and a GMP
/// organization.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum LinkVerificationState {
    /// The link state is unknown.
    Unspecified = 0,
    /// The link is established.
    Verified = 1,
    /// The link is requested, but hasn't been approved by the product account
    /// admin.
    NotVerified = 2,
}
impl LinkVerificationState {
    /// 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 => "LINK_VERIFICATION_STATE_UNSPECIFIED",
            Self::Verified => "LINK_VERIFICATION_STATE_VERIFIED",
            Self::NotVerified => "LINK_VERIFICATION_STATE_NOT_VERIFIED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "LINK_VERIFICATION_STATE_UNSPECIFIED" => Some(Self::Unspecified),
            "LINK_VERIFICATION_STATE_VERIFIED" => Some(Self::Verified),
            "LINK_VERIFICATION_STATE_NOT_VERIFIED" => Some(Self::NotVerified),
            _ => None,
        }
    }
}
/// Request message for GetOrganization RPC.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetOrganizationRequest {
    /// Required. The name of the Organization to retrieve.
    /// Format: organizations/{org_id}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
/// Request message for ListAnalyticsAccountLinks RPC.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListAnalyticsAccountLinksRequest {
    /// Required. The parent organization, which owns this collection of Analytics
    /// account links. Format: organizations/{org_id}
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// Optional. The maximum number of Analytics account links to return in one
    /// call. The service may return fewer than this value.
    ///
    /// If unspecified, at most 50 Analytics account links will be returned. The
    /// maximum value is 1000; values above 1000 will be coerced to 1000.
    #[prost(int32, tag = "2")]
    pub page_size: i32,
    /// Optional. A page token, received from a previous ListAnalyticsAccountLinks
    /// call. Provide this to retrieve the subsequent page.
    ///
    /// When paginating, all other parameters provided to
    /// `ListAnalyticsAccountLinks` must match the call that provided the page
    /// token.
    #[prost(string, tag = "3")]
    pub page_token: ::prost::alloc::string::String,
}
/// Response message for ListAnalyticsAccountLinks RPC.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListAnalyticsAccountLinksResponse {
    /// Analytics account links in this organization.
    #[prost(message, repeated, tag = "1")]
    pub analytics_account_links: ::prost::alloc::vec::Vec<AnalyticsAccountLink>,
    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    #[prost(string, tag = "2")]
    pub next_page_token: ::prost::alloc::string::String,
}
/// Request message for CreateAnalyticsAccountLink RPC.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateAnalyticsAccountLinkRequest {
    /// Required. The parent resource where this Analytics account link will be
    /// created. Format: organizations/{org_id}
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// Required. The Analytics account link to create.
    #[prost(message, optional, tag = "2")]
    pub analytics_account_link: ::core::option::Option<AnalyticsAccountLink>,
}
/// Request message for DeleteAnalyticsAccountLink RPC.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteAnalyticsAccountLinkRequest {
    /// Required. The name of the Analytics account link to delete.
    /// Format:
    /// organizations/{org_id}/analyticsAccountLinks/{analytics_account_link_id}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
/// Request message for SetPropertyServiceLevel RPC.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SetPropertyServiceLevelRequest {
    /// Required. The parent AnalyticsAccountLink scope where this property is in.
    /// Format:
    /// organizations/{org_id}/analyticsAccountLinks/{analytics_account_link_id}
    #[prost(string, tag = "1")]
    pub analytics_account_link: ::prost::alloc::string::String,
    /// Required. The Analytics property to change the ServiceLevel setting. This
    /// field is the name of the Google Analytics Admin API property resource.
    ///
    /// Format: analyticsadmin.googleapis.com/properties/{property_id}
    #[prost(string, tag = "2")]
    pub analytics_property: ::prost::alloc::string::String,
    /// Required. The service level to set for this property.
    #[prost(enumeration = "AnalyticsServiceLevel", tag = "3")]
    pub service_level: i32,
}
/// Response message for SetPropertyServiceLevel RPC.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SetPropertyServiceLevelResponse {}
/// Various levels of service for Google Analytics.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum AnalyticsServiceLevel {
    /// Service level unspecified.
    Unspecified = 0,
    /// The standard version of Google Analytics.
    Standard = 1,
    /// The premium version of Google Analytics.
    AnalyticsServiceLevel360 = 2,
}
impl AnalyticsServiceLevel {
    /// 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 => "ANALYTICS_SERVICE_LEVEL_UNSPECIFIED",
            Self::Standard => "ANALYTICS_SERVICE_LEVEL_STANDARD",
            Self::AnalyticsServiceLevel360 => "ANALYTICS_SERVICE_LEVEL_360",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ANALYTICS_SERVICE_LEVEL_UNSPECIFIED" => Some(Self::Unspecified),
            "ANALYTICS_SERVICE_LEVEL_STANDARD" => Some(Self::Standard),
            "ANALYTICS_SERVICE_LEVEL_360" => Some(Self::AnalyticsServiceLevel360),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod marketingplatform_admin_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 Interface for the Google Marketing Platform Admin API.
    #[derive(Debug, Clone)]
    pub struct MarketingplatformAdminServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl MarketingplatformAdminServiceClient<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> MarketingplatformAdminServiceClient<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,
        ) -> MarketingplatformAdminServiceClient<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,
        {
            MarketingplatformAdminServiceClient::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
        }
        /// Lookup for a single organization.
        pub async fn get_organization(
            &mut self,
            request: impl tonic::IntoRequest<super::GetOrganizationRequest>,
        ) -> std::result::Result<tonic::Response<super::Organization>, 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.marketingplatform.admin.v1alpha.MarketingplatformAdminService/GetOrganization",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.marketingplatform.admin.v1alpha.MarketingplatformAdminService",
                        "GetOrganization",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Lists the Google Analytics accounts link to the specified Google Marketing
        /// Platform organization.
        pub async fn list_analytics_account_links(
            &mut self,
            request: impl tonic::IntoRequest<super::ListAnalyticsAccountLinksRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListAnalyticsAccountLinksResponse>,
            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.marketingplatform.admin.v1alpha.MarketingplatformAdminService/ListAnalyticsAccountLinks",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.marketingplatform.admin.v1alpha.MarketingplatformAdminService",
                        "ListAnalyticsAccountLinks",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Creates the link between the Analytics account and the Google Marketing
        /// Platform organization.
        ///
        /// User needs to be an org user, and admin on the Analytics account to create
        /// the link. If the account is already linked to an organization, user needs
        /// to unlink the account from the current organization, then try link again.
        pub async fn create_analytics_account_link(
            &mut self,
            request: impl tonic::IntoRequest<super::CreateAnalyticsAccountLinkRequest>,
        ) -> std::result::Result<
            tonic::Response<super::AnalyticsAccountLink>,
            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.marketingplatform.admin.v1alpha.MarketingplatformAdminService/CreateAnalyticsAccountLink",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.marketingplatform.admin.v1alpha.MarketingplatformAdminService",
                        "CreateAnalyticsAccountLink",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Deletes the AnalyticsAccountLink, which detaches the Analytics account from
        /// the Google Marketing Platform organization.
        ///
        /// User needs to be an org user, and admin on the Analytics account in order
        /// to delete the link.
        pub async fn delete_analytics_account_link(
            &mut self,
            request: impl tonic::IntoRequest<super::DeleteAnalyticsAccountLinkRequest>,
        ) -> std::result::Result<tonic::Response<()>, 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.marketingplatform.admin.v1alpha.MarketingplatformAdminService/DeleteAnalyticsAccountLink",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.marketingplatform.admin.v1alpha.MarketingplatformAdminService",
                        "DeleteAnalyticsAccountLink",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Updates the service level for an Analytics property.
        pub async fn set_property_service_level(
            &mut self,
            request: impl tonic::IntoRequest<super::SetPropertyServiceLevelRequest>,
        ) -> std::result::Result<
            tonic::Response<super::SetPropertyServiceLevelResponse>,
            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.marketingplatform.admin.v1alpha.MarketingplatformAdminService/SetPropertyServiceLevel",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.marketingplatform.admin.v1alpha.MarketingplatformAdminService",
                        "SetPropertyServiceLevel",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
