// Copyright 2021 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.analytics.admin.v1alpha;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";

option go_package = "google.golang.org/genproto/googleapis/analytics/admin/v1alpha;admin";
option java_multiple_files = true;
option java_outer_classname = "ResourcesProto";
option java_package = "com.google.analytics.admin.v1alpha";

// Maximum access settings that Firebase user receive on the linked Analytics
// property.
enum MaximumUserAccess {
  // Unspecified maximum user access.
  MAXIMUM_USER_ACCESS_UNSPECIFIED = 0;

  // Firebase users have no access to the Analytics property.
  NO_ACCESS = 1;

  // Firebase users have Read & Analyze access to the Analytics property.
  READ_AND_ANALYZE = 2;

  // Firebase users have edit access to the Analytics property, but may not
  // manage the Firebase link.
  EDITOR_WITHOUT_LINK_MANAGEMENT = 3;

  // Firebase users have edit access to the Analytics property and may manage
  // the Firebase link.
  EDITOR_INCLUDING_LINK_MANAGEMENT = 4;
}

// The category selected for this property, used for industry benchmarking.
enum IndustryCategory {
  // Industry category unspecified
  INDUSTRY_CATEGORY_UNSPECIFIED = 0;

  // Automotive
  AUTOMOTIVE = 1;

  // Business and industrial markets
  BUSINESS_AND_INDUSTRIAL_MARKETS = 2;

  // Finance
  FINANCE = 3;

  // Healthcare
  HEALTHCARE = 4;

  // Technology
  TECHNOLOGY = 5;

  // Travel
  TRAVEL = 6;

  // Other
  OTHER = 7;

  // Arts and entertainment
  ARTS_AND_ENTERTAINMENT = 8;

  // Beauty and fitness
  BEAUTY_AND_FITNESS = 9;

  // Books and literature
  BOOKS_AND_LITERATURE = 10;

  // Food and drink
  FOOD_AND_DRINK = 11;

  // Games
  GAMES = 12;

  // Hobbies and leisure
  HOBBIES_AND_LEISURE = 13;

  // Home and garden
  HOME_AND_GARDEN = 14;

  // Internet and telecom
  INTERNET_AND_TELECOM = 15;

  // Law and government
  LAW_AND_GOVERNMENT = 16;

  // News
  NEWS = 17;

  // Online communities
  ONLINE_COMMUNITIES = 18;

  // People and society
  PEOPLE_AND_SOCIETY = 19;

  // Pets and animals
  PETS_AND_ANIMALS = 20;

  // Real estate
  REAL_ESTATE = 21;

  // Reference
  REFERENCE = 22;

  // Science
  SCIENCE = 23;

  // Sports
  SPORTS = 24;

  // Jobs and education
  JOBS_AND_EDUCATION = 25;

  // Shopping
  SHOPPING = 26;
}

// Different kinds of actors that can make changes to Google Analytics
// resources.
enum ActorType {
  // Unknown or unspecified actor type.
  ACTOR_TYPE_UNSPECIFIED = 0;

  // Changes made by the user specified in actor_email.
  USER = 1;

  // Changes made by the Google Analytics system.
  SYSTEM = 2;

  // Changes made by Google Analytics support team staff.
  SUPPORT = 3;
}

// Types of actions that may change a resource.
enum ActionType {
  // Action type unknown or not specified.
  ACTION_TYPE_UNSPECIFIED = 0;

  // Resource was created in this change.
  CREATED = 1;

  // Resource was updated in this change.
  UPDATED = 2;

  // Resource was deleted in this change.
  DELETED = 3;
}

// Types of resources whose changes may be returned from change history.
enum ChangeHistoryResourceType {
  // Resource type unknown or not specified.
  CHANGE_HISTORY_RESOURCE_TYPE_UNSPECIFIED = 0;

  // Account resource
  ACCOUNT = 1;

  // Property resource
  PROPERTY = 2;

  // WebDataStream resource
  WEB_DATA_STREAM = 3;

  // AndroidAppDataStream resource
  ANDROID_APP_DATA_STREAM = 4;

  // IosAppDataStream resource
  IOS_APP_DATA_STREAM = 5;

  // FirebaseLink resource
  FIREBASE_LINK = 6;

  // GoogleAdsLink resource
  GOOGLE_ADS_LINK = 7;

  // GoogleSignalsSettings resource
  GOOGLE_SIGNALS_SETTINGS = 8;

  // ConversionEvent resource
  CONVERSION_EVENT = 9;

  // MeasurementProtocolSecret resource
  MEASUREMENT_PROTOCOL_SECRET = 10;

  // CustomDimension resource
  CUSTOM_DIMENSION = 11;

  // CustomMetric resource
  CUSTOM_METRIC = 12;
}

// Status of the Google Signals settings (i.e., whether this feature has been
// enabled for the property).
enum GoogleSignalsState {
  // Google Signals status defaults to GOOGLE_SIGNALS_STATE_UNSPECIFIED to
  // represent that the user has not made an explicit choice.
  GOOGLE_SIGNALS_STATE_UNSPECIFIED = 0;

  // Google Signals is enabled.
  GOOGLE_SIGNALS_ENABLED = 1;

  // Google Signals is disabled.
  GOOGLE_SIGNALS_DISABLED = 2;
}

// Consent field of the Google Signals settings (i.e., whether the user has
// consented to the Google Signals terms of service.)
enum GoogleSignalsConsent {
  // Google Signals consent value defaults to
  // GOOGLE_SIGNALS_CONSENT_UNSPECIFIED.  This will be treated as
  // GOOGLE_SIGNALS_CONSENT_NOT_CONSENTED.
  GOOGLE_SIGNALS_CONSENT_UNSPECIFIED = 0;

  // Terms of service have been accepted
  GOOGLE_SIGNALS_CONSENT_CONSENTED = 2;

  // Terms of service have not been accepted
  GOOGLE_SIGNALS_CONSENT_NOT_CONSENTED = 1;
}

// A resource message representing a Google Analytics account.
message Account {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/Account"
    pattern: "accounts/{account}"
  };

  // Output only. Resource name of this account.
  // Format: accounts/{account}
  // Example: "accounts/100"
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when this account was originally created.
  google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when account payload fields were last updated.
  google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Required. Human-readable display name for this account.
  string display_name = 4 [(google.api.field_behavior) = REQUIRED];

  // Country of business. Must be a Unicode CLDR region code.
  string region_code = 5;

  // Output only. Indicates whether this Account is soft-deleted or not. Deleted
  // accounts are excluded from List results unless specifically requested.
  bool deleted = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// A resource message representing a Google Analytics GA4 property.
message Property {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/Property"
    pattern: "properties/{property}"
  };

  // Output only. Resource name of this property.
  // Format: properties/{property_id}
  // Example: "properties/1000"
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when the entity was originally created.
  google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when entity payload fields were last updated.
  google.protobuf.Timestamp update_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Immutable. Resource name of this property's logical parent.
  //
  // Note: The Property-Moving UI can be used to change the parent.
  // Format: accounts/{account}
  // Example: "accounts/100"
  string parent = 2 [(google.api.field_behavior) = IMMUTABLE];

  // Required. Human-readable display name for this property.
  //
  // The max allowed display name length is 100 UTF-16 code units.
  string display_name = 5 [(google.api.field_behavior) = REQUIRED];

  // Industry associated with this property
  // Example: AUTOMOTIVE, FOOD_AND_DRINK
  IndustryCategory industry_category = 6;

  // Required. Reporting Time Zone, used as the day boundary for reports, regardless of
  // where the data originates. If the time zone honors DST, Analytics will
  // automatically adjust for the changes.
  //
  // NOTE: Changing the time zone only affects data going forward, and is not
  // applied retroactively.
  //
  // Format: https://www.iana.org/time-zones
  // Example: "America/Los_Angeles"
  string time_zone = 7 [(google.api.field_behavior) = REQUIRED];

  // The currency type used in reports involving monetary values.
  //
  //
  // Format: https://en.wikipedia.org/wiki/ISO_4217
  // Examples: "USD", "EUR", "JPY"
  string currency_code = 8;

  // Output only. If set, the time at which this property was trashed. If not set, then this
  // property is not currently in the trash can.
  google.protobuf.Timestamp delete_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. If set, the time at which this trashed property will be permanently
  // deleted. If not set, then this property is not currently in the trash can
  // and is not slated to be deleted.
  google.protobuf.Timestamp expire_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// A resource message representing a Google Analytics Android app stream.
message AndroidAppDataStream {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/AndroidAppDataStream"
    pattern: "properties/{property}/androidAppDataStreams/{android_app_data_stream}"
  };

  // Output only. Resource name of this Data Stream.
  // Format: properties/{property_id}/androidAppDataStreams/{stream_id}
  // Example: "properties/1000/androidAppDataStreams/2000"
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. ID of the corresponding Android app in Firebase, if any.
  // This ID can change if the Android app is deleted and recreated.
  string firebase_app_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when this stream was originally created.
  google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when stream payload fields were last updated.
  google.protobuf.Timestamp update_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Immutable. The package name for the app being measured.
  // Example: "com.example.myandroidapp"
  string package_name = 5 [(google.api.field_behavior) = IMMUTABLE];

  // Human-readable display name for the Data Stream.
  //
  // The max allowed display name length is 255 UTF-16 code units.
  string display_name = 6;
}

// A resource message representing a Google Analytics IOS app stream.
message IosAppDataStream {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/IosAppDataStream"
    pattern: "properties/{property}/iosAppDataStreams/{ios_app_data_stream}"
  };

  // Output only. Resource name of this Data Stream.
  // Format: properties/{property_id}/iosAppDataStreams/{stream_id}
  // Example: "properties/1000/iosAppDataStreams/2000"
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. ID of the corresponding iOS app in Firebase, if any.
  // This ID can change if the iOS app is deleted and recreated.
  string firebase_app_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when this stream was originally created.
  google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when stream payload fields were last updated.
  google.protobuf.Timestamp update_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Required. Immutable. The Apple App Store Bundle ID for the app
  // Example: "com.example.myiosapp"
  string bundle_id = 5 [
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.field_behavior) = REQUIRED
  ];

  // Human-readable display name for the Data Stream.
  //
  // The max allowed display name length is 255 UTF-16 code units.
  string display_name = 6;
}

// A resource message representing a Google Analytics web stream.
message WebDataStream {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/WebDataStream"
    pattern: "properties/{property}/webDataStreams/{web_data_stream}"
  };

  // Output only. Resource name of this Data Stream.
  // Format: properties/{property_id}/webDataStreams/{stream_id}
  // Example: "properties/1000/webDataStreams/2000"
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Analytics "Measurement ID", without the "G-" prefix.
  // Example: "G-1A2BCD345E" would just be "1A2BCD345E"
  string measurement_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. ID of the corresponding web app in Firebase, if any.
  // This ID can change if the web app is deleted and recreated.
  string firebase_app_id = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when this stream was originally created.
  google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when stream payload fields were last updated.
  google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Immutable. Domain name of the web app being measured, or empty.
  // Example: "http://www.google.com", "https://www.google.com"
  string default_uri = 6 [(google.api.field_behavior) = IMMUTABLE];

  // Required. Human-readable display name for the Data Stream.
  //
  // The max allowed display name length is 100 UTF-16 code units.
  string display_name = 7 [(google.api.field_behavior) = REQUIRED];
}

// A resource message representing a user's permissions on an Account or
// Property resource.
message UserLink {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/UserLink"
    pattern: "accounts/{account}/userLinks/{user_link}"
    pattern: "properties/{property}/userLinks/{user_link}"
  };

  // Output only. Example format: properties/1234/userLinks/5678
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Immutable. Email address of the user to link
  string email_address = 2 [(google.api.field_behavior) = IMMUTABLE];

  // Roles directly assigned to this user for this account or property.
  //
  // Valid values:
  // predefinedRoles/read
  // predefinedRoles/collaborate
  // predefinedRoles/edit
  // predefinedRoles/manage-users
  //
  // Excludes roles that are inherited from a higher-level entity, group,
  // or organization admin role.
  //
  // A UserLink that is updated to have an empty list of direct_roles will be
  // deleted.
  repeated string direct_roles = 3;
}

// Read-only resource used to summarize a principal's effective roles.
message AuditUserLink {
  // Example format: properties/1234/userLinks/5678
  string name = 1;

  // Email address of the linked user
  string email_address = 2;

  // Roles directly assigned to this user for this entity.
  //
  // Format: predefinedRoles/read
  //
  // Excludes roles that are inherited from an account (if this is for a
  // property), group, or organization admin role.
  repeated string direct_roles = 3;

  // Union of all permissions a user has at this account or property (includes
  // direct permissions, group-inherited permissions, etc.).
  //
  // Format: predefinedRoles/read
  repeated string effective_roles = 4;
}

// Singleton resource under a WebDataStream, configuring measurement of
// additional site interactions and content.
message EnhancedMeasurementSettings {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/EnhancedMeasurementSettings"
    pattern: "properties/{property}/webDataStreams/{web_data_stream}/enhancedMeasurementSettings"
  };

  // Output only. Resource name of this Data Stream.
  // Format:
  // properties/{property_id}/webDataStreams/{stream_id}/enhancedMeasurementSettings
  // Example: "properties/1000/webDataStreams/2000/enhancedMeasurementSettings"
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Indicates whether Enhanced Measurement Settings will be used to
  // automatically measure interactions and content on this web stream.
  //
  // Changing this value does not affect the settings themselves, but determines
  // whether they are respected.
  bool stream_enabled = 2;

  // Output only. If enabled, capture a page view event each time a page loads or the
  // website changes the browser history state.
  bool page_views_enabled = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // If enabled, capture scroll events each time a visitor gets to the bottom of
  // a page.
  bool scrolls_enabled = 4;

  // If enabled, capture an outbound click event each time a visitor clicks a
  // link that leads them away from your domain.
  bool outbound_clicks_enabled = 5;

  // If enabled, capture a view search results event each time a visitor
  // performs a search on your site (based on a query parameter).
  bool site_search_enabled = 7;

  // If enabled, capture video play, progress, and complete events as visitors
  // view embedded videos on your site.
  bool video_engagement_enabled = 9;

  // If enabled, capture a file download event each time a link is clicked with
  // a common document, compressed file, application, video, or audio extension.
  bool file_downloads_enabled = 10;

  // Output only. If enabled, capture a page view event each time a page loads.
  bool page_loads_enabled = 12 [(google.api.field_behavior) = OUTPUT_ONLY];

  // If enabled, capture a page view event each time the website changes the
  // browser history state.
  bool page_changes_enabled = 13;

  // Required. URL query parameters to interpret as site search parameters.
  // Max length is 1024 characters. Must not be empty.
  string search_query_parameter = 16 [(google.api.field_behavior) = REQUIRED];

  // Additional URL query parameters.
  // Max length is 1024 characters.
  string uri_query_parameter = 17;
}

// A link between an GA4 property and a Firebase project.
message FirebaseLink {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/FirebaseLink"
    pattern: "properties/{property}/firebaseLinks/{firebase_link}"
  };

  // Output only. Example format: properties/1234/firebaseLinks/5678
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Immutable. Firebase project resource name. When creating a FirebaseLink, you may
  // provide this resource name using either a project number or project ID.
  // Once this resource has been created, returned FirebaseLinks will always
  // have a project_name that contains a project number.
  //
  // Format: 'projects/{project number}'
  // Example: 'projects/1234'
  string project = 2 [(google.api.field_behavior) = IMMUTABLE];

  // Output only. Time when this FirebaseLink was originally created.
  google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Maximum user access to the GA4 property allowed to admins of
  // the linked Firebase project.
  MaximumUserAccess maximum_user_access = 4;
}

// Read-only resource with the tag for sending data from a website to a
// WebDataStream.
message GlobalSiteTag {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/GlobalSiteTag"
    pattern: "properties/{property}/globalSiteTag"
  };

  // Output only. Resource name for this GlobalSiteTag resource.
  // Format: properties/{propertyId}/globalSiteTag
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Immutable. JavaScript code snippet to be pasted as the first item into the head tag of
  // every webpage to measure.
  string snippet = 2 [(google.api.field_behavior) = IMMUTABLE];
}

// A link between an GA4 property and a Google Ads account.
message GoogleAdsLink {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/GoogleAdsLink"
    pattern: "properties/{property}/googleAdsLinks/{google_ads_link}"
  };

  // Output only. Format: properties/{propertyId}/googleAdsLinks/{googleAdsLinkId}
  //
  // Note: googleAdsLinkId is not the Google Ads customer ID.
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Immutable. Google Ads customer ID.
  string customer_id = 3 [(google.api.field_behavior) = IMMUTABLE];

  // Output only. If true, this link is for a Google Ads manager account.
  bool can_manage_clients = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Enable personalized advertising features with this integration.
  // Automatically publish my Google Analytics audience lists and Google
  // Analytics remarketing events/parameters to the linked Google Ads account.
  // If this field is not set on create/update, it will be defaulted to true.
  google.protobuf.BoolValue ads_personalization_enabled = 5;

  // Output only. Email address of the user that created the link.
  // An empty string will be returned if the email address can't be retrieved.
  string email_address = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when this link was originally created.
  google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when this link was last updated.
  google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// A resource message representing data sharing settings of a Google Analytics
// account.
message DataSharingSettings {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/DataSharingSettings"
    pattern: "accounts/{account}/dataSharingSettings"
  };

  // Output only. Resource name.
  // Format: accounts/{account}/dataSharingSettings
  // Example: "accounts/1000/dataSharingSettings"
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Allows Google support to access the data in order to help troubleshoot
  // issues.
  bool sharing_with_google_support_enabled = 2;

  // Allows Google sales teams that are assigned to the customer to access the
  // data in order to suggest configuration changes to improve results.
  // Sales team restrictions still apply when enabled.
  bool sharing_with_google_assigned_sales_enabled = 3;

  // Allows any of Google sales to access the data in order to suggest
  // configuration changes to improve results.
  bool sharing_with_google_any_sales_enabled = 4;

  // Allows Google to use the data to improve other Google products or services.
  bool sharing_with_google_products_enabled = 5;

  // Allows Google to share the data anonymously in aggregate form with others.
  bool sharing_with_others_enabled = 6;
}

// A virtual resource representing an overview of an account and
// all its child GA4 properties.
message AccountSummary {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/AccountSummary"
    pattern: "accountSummaries/{account_summary}"
  };

  // Resource name for this account summary.
  // Format: accountSummaries/{account_id}
  // Example: "accountSummaries/1000"
  string name = 1;

  // Resource name of account referred to by this account summary
  // Format: accounts/{account_id}
  // Example: "accounts/1000"
  string account = 2 [(google.api.resource_reference) = {
                        type: "analyticsadmin.googleapis.com/Account"
                      }];

  // Display name for the account referred to in this account summary.
  string display_name = 3;

  // List of summaries for child accounts of this account.
  repeated PropertySummary property_summaries = 4;
}

// A virtual resource representing metadata for an GA4 property.
message PropertySummary {
  // Resource name of property referred to by this property summary
  // Format: properties/{property_id}
  // Example: "properties/1000"
  string property = 1 [(google.api.resource_reference) = {
                         type: "analyticsadmin.googleapis.com/Property"
                       }];

  // Display name for the property referred to in this account summary.
  string display_name = 2;
}

// A secret value used for sending hits to Measurement Protocol.
message MeasurementProtocolSecret {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/MeasurementProtocolSecret"
    pattern: "properties/{property}/webDataStreams/{web_data_stream}/measurementProtocolSecrets/{measurement_protocol_secret}"
  };

  // Output only. Resource name of this secret. This secret may be a child of any type of
  // stream.
  // Format:
  // properties/{property}/webDataStreams/{webDataStream}/measurementProtocolSecrets/{measurementProtocolSecret}
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Required. Human-readable display name for this secret.
  string display_name = 2 [(google.api.field_behavior) = REQUIRED];

  // Output only. The measurement protocol secret value. Pass this value to the api_secret
  // field of the Measurement Protocol API when sending hits to this
  // secret's parent property.
  string secret_value = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// A set of changes within a Google Analytics account or its child properties
// that resulted from the same cause. Common causes would be updates made in the
// Google Analytics UI, changes from customer support, or automatic Google
// Analytics system changes.
message ChangeHistoryEvent {
  // ID of this change history event. This ID is unique across Google Analytics.
  string id = 1;

  // Time when change was made.
  google.protobuf.Timestamp change_time = 2;

  // The type of actor that made this change.
  ActorType actor_type = 3;

  // Email address of the Google account that made the change. This will be a
  // valid email address if the actor field is set to USER, and empty otherwise.
  // Google accounts that have been deleted will cause an error.
  string user_actor_email = 4;

  // If true, then the list of changes returned was filtered, and does not
  // represent all changes that occurred in this event.
  bool changes_filtered = 5;

  // A list of changes made in this change history event that fit the filters
  // specified in SearchChangeHistoryEventsRequest.
  repeated ChangeHistoryChange changes = 6;
}

// A description of a change to a single Google Analytics resource.
message ChangeHistoryChange {
  // A snapshot of a resource as before or after the result of a change in
  // change history.
  message ChangeHistoryResource {
    oneof resource {
      // A snapshot of an Account resource in change history.
      Account account = 1;

      // A snapshot of a Property resource in change history.
      Property property = 2;

      // A snapshot of a WebDataStream resource in change history.
      WebDataStream web_data_stream = 3;

      // A snapshot of an AndroidAppDataStream resource in change history.
      AndroidAppDataStream android_app_data_stream = 4;

      // A snapshot of an IosAppDataStream resource in change history.
      IosAppDataStream ios_app_data_stream = 5;

      // A snapshot of a FirebaseLink resource in change history.
      FirebaseLink firebase_link = 6;

      // A snapshot of a GoogleAdsLink resource in change history.
      GoogleAdsLink google_ads_link = 7;

      // A snapshot of a GoogleSignalsSettings resource in change history.
      GoogleSignalsSettings google_signals_settings = 8;

      // A snapshot of a ConversionEvent resource in change history.
      ConversionEvent conversion_event = 11;

      // A snapshot of a MeasurementProtocolSecret resource in change history.
      MeasurementProtocolSecret measurement_protocol_secret = 12;

      // A snapshot of a CustomDimension resource in change history.
      CustomDimension custom_dimension = 13;

      // A snapshot of a CustomMetric resource in change history.
      CustomMetric custom_metric = 14;
    }
  }

  // Resource name of the resource whose changes are described by this entry.
  string resource = 1;

  // The type of action that changed this resource.
  ActionType action = 2;

  // Resource contents from before the change was made. If this resource was
  // created in this change, this field will be missing.
  ChangeHistoryResource resource_before_change = 3;

  // Resource contents from after the change was made. If this resource was
  // deleted in this change, this field will be missing.
  ChangeHistoryResource resource_after_change = 4;
}

// A conversion event in a Google Analytics property.
message ConversionEvent {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/ConversionEvent"
    pattern: "properties/{property}/conversionEvents/{conversion_event}"
  };

  // Output only. Resource name of this conversion event.
  // Format: properties/{property}/conversionEvents/{conversion_event}
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Immutable. The event name for this conversion event.
  // Examples: 'click', 'purchase'
  string event_name = 2 [(google.api.field_behavior) = IMMUTABLE];

  // Output only. Time when this conversion event was created in the property.
  google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. If set, this event can currently be deleted via DeleteConversionEvent.
  bool is_deletable = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Settings values for Google Signals.  This is a singleton resource.
message GoogleSignalsSettings {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/GoogleSignalsSettings"
    pattern: "properties/{property}/googleSignalsSettings"
  };

  // Output only. Resource name of this setting.
  // Format: properties/{property_id}/googleSignalsSettings
  // Example: "properties/1000/googleSignalsSettings"
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Status of this setting.
  GoogleSignalsState state = 3;

  // Output only. Terms of Service acceptance.
  GoogleSignalsConsent consent = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// A definition for a CustomDimension.
message CustomDimension {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/CustomDimension"
    pattern: "properties/{property}/customDimensions"
  };

  // Valid values for the scope of this dimension.
  enum DimensionScope {
    // Scope unknown or not specified.
    DIMENSION_SCOPE_UNSPECIFIED = 0;

    // Dimension scoped to an event.
    EVENT = 1;

    // Dimension scoped to a user.
    USER = 2;
  }

  // Output only. Resource name for this CustomDimension resource.
  // Format: properties/{property}/customDimensions/{customDimension}
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Required. Immutable. Tagging parameter name for this custom dimension.
  //
  // If this is a user-scoped dimension, then this is the user property name.
  // If this is an event-scoped dimension, then this is the event parameter
  // name.
  //
  // May only contain alphanumeric and underscore characters, starting with a
  // letter. Max length of 24 characters for user-scoped dimensions, 40
  // characters for event-scoped dimensions.
  string parameter_name = 2 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Required. Display name for this custom dimension as shown in the Analytics UI.
  // Max length of 82 characters, alphanumeric plus space and underscore
  // starting with a letter. Legacy system-generated display names may contain
  // square brackets, but updates to this field will never permit square
  // brackets.
  string display_name = 3 [(google.api.field_behavior) = REQUIRED];

  // Optional. Description for this custom dimension. Max length of 150 characters.
  string description = 4 [(google.api.field_behavior) = OPTIONAL];

  // Required. Immutable. The scope of this dimension.
  DimensionScope scope = 5 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. If set to true, sets this dimension as NPA and excludes it from ads
  // personalization.
  //
  // This is currently only supported by user-scoped custom dimensions.
  bool disallow_ads_personalization = 6 [(google.api.field_behavior) = OPTIONAL];
}

// A definition for a custom metric.
message CustomMetric {
  option (google.api.resource) = {
    type: "analyticsadmin.googleapis.com/CustomMetric"
    pattern: "properties/{property}/customMetrics"
  };

  // Possible types of representing the custom metric's value.
  //
  // Currency representation may change in the future, requiring a breaking API
  // change.
  enum MeasurementUnit {
    // MeasurementUnit unspecified or missing.
    MEASUREMENT_UNIT_UNSPECIFIED = 0;

    // This metric uses default units.
    STANDARD = 1;

    // This metric measures a currency.
    CURRENCY = 2;

    // This metric measures feet.
    FEET = 3;

    // This metric measures meters.
    METERS = 4;

    // This metric measures kilometers.
    KILOMETERS = 5;

    // This metric measures miles.
    MILES = 6;

    // This metric measures milliseconds.
    MILLISECONDS = 7;

    // This metric measures seconds.
    SECONDS = 8;

    // This metric measures minutes.
    MINUTES = 9;

    // This metric measures hours.
    HOURS = 10;
  }

  // The scope of this metric.
  enum MetricScope {
    // Scope unknown or not specified.
    METRIC_SCOPE_UNSPECIFIED = 0;

    // Metric scoped to an event.
    EVENT = 1;
  }

  // Output only. Resource name for this CustomMetric resource.
  // Format: properties/{property}/customMetrics/{customMetric}
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Required. Immutable. Tagging name for this custom metric.
  //
  // If this is an event-scoped metric, then this is the event parameter
  // name.
  //
  // May only contain alphanumeric and underscore charactes, starting with a
  // letter. Max length of 40 characters for event-scoped metrics.
  string parameter_name = 2 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Required. Display name for this custom metric as shown in the Analytics UI.
  // Max length of 82 characters, alphanumeric plus space and underscore
  // starting with a letter. Legacy system-generated display names may contain
  // square brackets, but updates to this field will never permit square
  // brackets.
  string display_name = 3 [(google.api.field_behavior) = REQUIRED];

  // Optional. Description for this custom dimension.
  // Max length of 150 characters.
  string description = 4 [(google.api.field_behavior) = OPTIONAL];

  // Required. Immutable. The type for the custom metric's value.
  MeasurementUnit measurement_unit = 5 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Required. Immutable. The scope of this custom metric.
  MetricScope scope = 6 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];
}
