// 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.cloud.discoveryengine.v1beta;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/type/latlng.proto";

option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Beta";
option go_package = "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb;discoveryenginepb";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
option java_package = "com.google.cloud.discoveryengine.v1beta";
option objc_class_prefix = "DISCOVERYENGINE";
option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1beta";
option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta";
option (google.api.resource_definition) = {
  type: "discoveryengine.googleapis.com/Branch"
  pattern: "projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}"
  pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}"
};
option (google.api.resource_definition) = {
  type: "discoveryengine.googleapis.com/Collection"
  pattern: "projects/{project}/locations/{location}/collections/{collection}"
};
option (google.api.resource_definition) = {
  type: "discoveryengine.googleapis.com/Location"
  pattern: "projects/{project}/locations/{location}"
};
option (google.api.resource_definition) = {
  type: "discoveryengine.googleapis.com/RankingConfig"
  pattern: "projects/{project}/locations/{location}/rankingConfigs/{ranking_config}"
};
option (google.api.resource_definition) = {
  type: "discoveryengine.googleapis.com/CompletionConfig"
  pattern: "projects/{project}/locations/{location}/dataStores/{data_store}/completionConfig"
  pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/completionConfig"
  pattern: "projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/completionConfig"
};
option (google.api.resource_definition) = {
  type: "discoveryengine.googleapis.com/BillingAccountLicenseConfig"
  pattern: "billingAccounts/{billing_account}/billingAccountLicenseConfigs/{billing_account_license_config}"
};
option (google.api.resource_definition) = {
  type: "networkservices.googleapis.com/AgentGateway"
  pattern: "projects/{project}/locations/{location}/agentGateways/{agent_gateway}"
};
option (google.api.resource_definition) = {
  type: "modelarmor.googleapis.com/Template"
  pattern: "projects/{project}/locations/{location}/templates/{template}"
};
option (google.api.resource_definition) = {
  type: "dlp.googleapis.com/ContentPolicy"
  pattern: "organizations/{organization}/locations/{location}/contentPolicies/{content_policy}"
  pattern: "projects/{project}/locations/{location}/contentPolicies/{content_policy}"
};
option (google.api.resource_definition) = {
  type: "healthcare.googleapis.com/FhirStore"
  pattern: "projects/{project}/locations/{location}/datasets/{dataset}/fhirStores/{fhir_store}"
};
option (google.api.resource_definition) = {
  type: "healthcare.googleapis.com/FhirResource"
  pattern: "projects/{project}/locations/{location}/datasets/{dataset}/fhirStores/{fhir_store}/fhir/{resource_type}/{fhir_resource_id}"
};
option (google.api.resource_definition) = {
  type: "cloudkms.googleapis.com/CryptoKeys"
  pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}"
};
option (google.api.resource_definition) = {
  type: "cloudkms.googleapis.com/CryptoKeyVersions"
  pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}"
};

// The industry vertical associated with the
// [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
enum IndustryVertical {
  // Value used when unset.
  INDUSTRY_VERTICAL_UNSPECIFIED = 0;

  // The generic vertical for documents that are not specific to any industry
  // vertical.
  GENERIC = 1;

  // The media industry vertical.
  MEDIA = 2;

  // The healthcare FHIR vertical.
  HEALTHCARE_FHIR = 7;
}

// The type of solution.
enum SolutionType {
  // Default value.
  SOLUTION_TYPE_UNSPECIFIED = 0;

  // Used for Recommendations AI.
  SOLUTION_TYPE_RECOMMENDATION = 1;

  // Used for Discovery Search.
  SOLUTION_TYPE_SEARCH = 2;

  // Used for use cases related to the Generative AI agent.
  SOLUTION_TYPE_CHAT = 3;

  // Used for use cases related to the Generative Chat agent.
  // It's used for Generative chat engine only, the associated data stores
  // must enrolled with `SOLUTION_TYPE_CHAT` solution.
  SOLUTION_TYPE_GENERATIVE_CHAT = 4;

  // Used for AI Mode.
  SOLUTION_TYPE_AI_MODE = 5;
}

// Defines a further subdivision of `SolutionType`.
// Specifically applies to
// [SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_SEARCH].
enum SearchUseCase {
  // Value used when unset. Will not occur in CSS.
  SEARCH_USE_CASE_UNSPECIFIED = 0;

  // Search use case. Expects the traffic has a non-empty
  // [query][google.cloud.discoveryengine.v1beta.SearchRequest.query].
  SEARCH_USE_CASE_SEARCH = 1;

  // Browse use case. Expects the traffic has an empty
  // [query][google.cloud.discoveryengine.v1beta.SearchRequest.query].
  SEARCH_USE_CASE_BROWSE = 2;
}

// Tiers of search features. Different tiers might have different
// pricing. To learn more, check the pricing documentation.
enum SearchTier {
  // Default value when the enum is unspecified. This is invalid to use.
  SEARCH_TIER_UNSPECIFIED = 0;

  // Standard tier.
  SEARCH_TIER_STANDARD = 1;

  // Enterprise tier.
  SEARCH_TIER_ENTERPRISE = 2;
}

// Add-on that provides additional functionality for search.
enum SearchAddOn {
  // Default value when the enum is unspecified. This is invalid to use.
  SEARCH_ADD_ON_UNSPECIFIED = 0;

  // Large language model add-on.
  SEARCH_ADD_ON_LLM = 1;
}

// Subscription tier information.
enum SubscriptionTier {
  // Default value.
  SUBSCRIPTION_TIER_UNSPECIFIED = 0;

  // Search tier.
  // Search tier can access Vertex AI Search features and NotebookLM features.
  SUBSCRIPTION_TIER_SEARCH = 1;

  // Gemini Enterprise Plus tier.
  SUBSCRIPTION_TIER_SEARCH_AND_ASSISTANT = 2;

  // NotebookLM tier.
  // NotebookLM is a subscription tier can only access NotebookLM features.
  SUBSCRIPTION_TIER_NOTEBOOK_LM = 3;

  // Gemini Frontline worker tier.
  SUBSCRIPTION_TIER_FRONTLINE_WORKER = 4;

  // Gemini Business Starter tier.
  SUBSCRIPTION_TIER_AGENTSPACE_STARTER = 10;

  // Gemini Business tier.
  SUBSCRIPTION_TIER_AGENTSPACE_BUSINESS = 6;

  // Gemini Enterprise Standard tier.
  SUBSCRIPTION_TIER_ENTERPRISE = 7;

  // Gemini Enterprise Standard tier for emerging markets.
  SUBSCRIPTION_TIER_ENTERPRISE_EMERGING = 15;

  // Gemini Enterprise EDU tier.
  SUBSCRIPTION_TIER_EDU = 8;

  // Gemini Enterprise EDU Pro tier.
  SUBSCRIPTION_TIER_EDU_PRO = 9;

  // Gemini Enterprise EDU tier for emerging market only.
  SUBSCRIPTION_TIER_EDU_EMERGING = 11;

  // Gemini Enterprise EDU Pro tier for emerging market.
  SUBSCRIPTION_TIER_EDU_PRO_EMERGING = 12;

  // Gemini Frontline Starter tier.
  SUBSCRIPTION_TIER_FRONTLINE_STARTER = 13;
}

// Subscription term.
enum SubscriptionTerm {
  // Default value, do not use.
  SUBSCRIPTION_TERM_UNSPECIFIED = 0;

  // 1 month.
  SUBSCRIPTION_TERM_ONE_MONTH = 1;

  // 1 year.
  SUBSCRIPTION_TERM_ONE_YEAR = 2;

  // 3 years.
  SUBSCRIPTION_TERM_THREE_YEARS = 3;

  // Custom term. Must set the end_date.
  SUBSCRIPTION_TERM_CUSTOM = 6;
}

// A floating point interval.
message Interval {
  // The lower bound of the interval. If neither of the min fields are
  // set, then the lower bound is negative infinity.
  //
  // This field must be not larger than max.
  // Otherwise, an `INVALID_ARGUMENT` error is returned.
  oneof min {
    // Inclusive lower bound.
    double minimum = 1;

    // Exclusive lower bound.
    double exclusive_minimum = 2;
  }

  // The upper bound of the interval. If neither of the max fields are
  // set, then the upper bound is positive infinity.
  //
  // This field must be not smaller than min.
  // Otherwise, an `INVALID_ARGUMENT` error is returned.
  oneof max {
    // Inclusive upper bound.
    double maximum = 3;

    // Exclusive upper bound.
    double exclusive_maximum = 4;
  }
}

// A custom attribute that is not explicitly modeled in a resource, e.g.
// [UserEvent][google.cloud.discoveryengine.v1beta.UserEvent].
message CustomAttribute {
  // The textual values of this custom attribute. For example, `["yellow",
  // "green"]` when the key is "color".
  //
  // Empty string is not allowed. Otherwise, an `INVALID_ARGUMENT` error is
  // returned.
  //
  // Exactly one of
  // [CustomAttribute.text][google.cloud.discoveryengine.v1beta.CustomAttribute.text]
  // or
  // [CustomAttribute.numbers][google.cloud.discoveryengine.v1beta.CustomAttribute.numbers]
  // should be set. Otherwise, an `INVALID_ARGUMENT` error is returned.
  repeated string text = 1;

  // The numerical values of this custom attribute. For example, `[2.3, 15.4]`
  // when the key is "lengths_cm".
  //
  // Exactly one of
  // [CustomAttribute.text][google.cloud.discoveryengine.v1beta.CustomAttribute.text]
  // or
  // [CustomAttribute.numbers][google.cloud.discoveryengine.v1beta.CustomAttribute.numbers]
  // should be set. Otherwise, an `INVALID_ARGUMENT` error is returned.
  repeated double numbers = 2;
}

// Information of an end user.
message UserInfo {
  // Precise location info with multiple representation options.
  // Currently only latitude and longitude point is supported.
  message PreciseLocation {
    oneof location {
      // Optional. Location represented by a latitude/longitude point.
      google.type.LatLng point = 1 [(google.api.field_behavior) = OPTIONAL];

      // Optional. Location represented by a natural language address. Will
      // later be geocoded and converted to either a point or a polygon.
      string address = 2 [(google.api.field_behavior) = OPTIONAL];
    }
  }

  // Highly recommended for logged-in users. Unique identifier for logged-in
  // user, such as a user name. Don't set for anonymous users.
  //
  // Always use a hashed value for this ID.
  //
  // Don't set the field to the same fixed ID for different users. This mixes
  // the event history of those users together, which results in degraded
  // model quality.
  //
  // The field must be a UTF-8 encoded string with a length limit of 128
  // characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
  //
  // Represents an opaque ID to the Search API. The Search API doesn't
  // interpret the value in any way. This field is used to associate events
  // with a user across sessions if the events are being uploaded.
  string user_id = 1;

  // User agent as included in the HTTP header.
  //
  // The field must be a UTF-8 encoded string with a length limit of 1,000
  // characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
  //
  // This should not be set when using the client side event reporting with
  // GTM or JavaScript tag in
  // [UserEventService.CollectUserEvent][google.cloud.discoveryengine.v1beta.UserEventService.CollectUserEvent]
  // or if
  // [UserEvent.direct_user_request][google.cloud.discoveryengine.v1beta.UserEvent.direct_user_request]
  // is set.
  string user_agent = 2;

  // Optional. IANA time zone, e.g. Europe/Budapest.
  string time_zone = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Input only. Precise location of the user.
  // It is used in Custom Ranking to calculate the distance between the user and
  // the relevant documents.
  PreciseLocation precise_location = 4 [
    (google.api.field_behavior) = INPUT_ONLY,
    (google.api.field_behavior) = OPTIONAL
  ];
}

// Defines embedding config, used for bring your own embeddings feature.
message EmbeddingConfig {
  // Full field path in the schema mapped as embedding field.
  string field_path = 1;
}

// Double list.
message DoubleList {
  // Double values.
  repeated double values = 1;
}

// Identity Provider Config.
message IdpConfig {
  // Third party IDP Config.
  message ExternalIdpConfig {
    // Workforce pool name.
    // Example: "locations/global/workforcePools/pool_id"
    string workforce_pool_name = 1;
  }

  // Identity Provider Type.
  enum IdpType {
    // Default value. ACL search not enabled.
    IDP_TYPE_UNSPECIFIED = 0;

    // Google 1P provider.
    GSUITE = 1;

    // Third party provider.
    THIRD_PARTY = 2;
  }

  // Identity provider type configured.
  IdpType idp_type = 1;

  // External Identity provider config.
  ExternalIdpConfig external_idp_config = 2;
}

// Principal identifier of a user or a group.
message Principal {
  // Union field principal. Principal can be a user or a group.
  oneof principal {
    // User identifier.
    // For Google Workspace user account, user_id should be the google workspace
    // user email.
    // For non-google identity provider user account, user_id is the mapped user
    // identifier configured during the workforcepool config.
    string user_id = 1;

    // Group identifier.
    // For Google Workspace user account, group_id should be the google
    // workspace group email.
    // For non-google identity provider user account, group_id is the mapped
    // group identifier configured during the workforcepool config.
    string group_id = 2;

    // For 3P application identities which are not present in the customer
    // identity provider.
    string external_entity_id = 3;
  }
}

// Config to data store for `HEALTHCARE_FHIR` vertical.
message HealthcareFhirConfig {
  // Whether to enable configurable schema for `HEALTHCARE_FHIR` vertical.
  //
  // If set to `true`, the predefined healthcare fhir schema can be extended
  // for more customized searching and filtering.
  bool enable_configurable_schema = 1;

  // Whether to enable static indexing for `HEALTHCARE_FHIR` batch
  // ingestion.
  //
  // If set to `true`, the batch ingestion will be processed in a static
  // indexing mode which is slower but more capable of handling larger
  // volume.
  bool enable_static_indexing_for_batch_ingestion = 2;

  // Optional. Names of the Group resources to use as a basis for the initial
  // patient filter, in format
  // `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}/fhir/Group/{group_id}`.
  // The filter group must be a FHIR resource name of
  // type Group, and the filter will be constructed from the direct members of
  // the group which are Patient resources.
  repeated string initial_filter_groups = 4
      [(google.api.field_behavior) = OPTIONAL];
}

// Promotion proto includes uri and other helping information to display the
// promotion.
message SearchLinkPromotion {
  // Required. The title of the promotion.
  // Maximum length: 160 characters.
  string title = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. The URL for the page the user wants to promote. Must be set for
  // site search. For other verticals, this is optional.
  string uri = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The [Document][google.cloud.discoveryengine.v1beta.Document] the
  // user wants to promote. For site search, leave unset and only populate uri.
  // Can be set along with uri.
  string document = 6 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = {
      type: "discoveryengine.googleapis.com/Document"
    }
  ];

  // Optional. The promotion thumbnail image url.
  string image_uri = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The Promotion description.
  // Maximum length: 200 characters.
  string description = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The enabled promotion will be returned for any serving configs
  // associated with the parent of the control this promotion is attached to.
  //
  // This flag is used for basic site search only.
  bool enabled = 5 [(google.api.field_behavior) = OPTIONAL];
}
