// Copyright 2020 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.retail.v2;

import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";

option csharp_namespace = "Google.Cloud.Retail.V2";
option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail";
option java_multiple_files = true;
option java_outer_classname = "CatalogProto";
option java_package = "com.google.cloud.retail.v2";
option objc_class_prefix = "RETAIL";
option php_namespace = "Google\\Cloud\\Retail\\V2";
option ruby_package = "Google::Cloud::Retail::V2";

// Configures what level the product should be uploaded with regards to
// how users will be send events and how predictions will be made.
message ProductLevelConfig {
  // The type of [Product][google.cloud.retail.v2.Product]s allowed to be
  // ingested into the catalog. Acceptable values are:
  //
  // * `primary` (default): You can only ingest PRIMARY
  // [Product][google.cloud.retail.v2.Product]s. This means
  //   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
  //   can only be empty or set to the same value as
  //   [Product.id][google.cloud.retail.v2.Product.id].
  // * `variant`: You can only ingest VARIANT
  // [Product][google.cloud.retail.v2.Product]s. This means
  //   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
  //   cannot be empty.
  //
  // If this field is set to an invalid value other than these, an
  // INVALID_ARGUMENT error is returned.
  //
  // If this field is `variant` and
  // [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
  // is `itemGroupId`, an INVALID_ARGUMENT error is returned.
  //
  // See
  // https://cloud.google.com/recommendations-ai/docs/catalog#catalog-levels
  // for more details.
  string ingestion_product_type = 1;

  // Which field of [Merchant Center
  //
  // Product](https:
  // //cloud.google.com/bigquery-transfer/docs/merchant-center-products-schema)
  // should be imported as [Product.id][google.cloud.retail.v2.Product.id].
  // Acceptable values are:
  //
  // * `offerId` (default): Import `offerId` as the product ID.
  // * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
  //   API will choose one item from the ones with the same `itemGroupId`, and
  //   use it to represent the item group.
  //
  // If this field is set to an invalid value other than these, an
  // INVALID_ARGUMENT error is returned.
  //
  // If this field is `itemGroupId` and
  // [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
  // is `variant`, an INVALID_ARGUMENT error is returned.
  //
  // See
  // https://cloud.google.com/recommendations-ai/docs/catalog#catalog-levels
  // for more details.
  string merchant_center_product_id_field = 2;
}

// The catalog configuration.
// Next ID: 5.
message Catalog {
  option (google.api.resource) = {
    type: "retail.googleapis.com/Catalog"
    pattern: "projects/{project}/locations/{location}/catalogs/{catalog}"
  };

  // Required. Immutable. The fully qualified resource name of the catalog.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Required. Immutable. The catalog display name.
  //
  // This field must be a UTF-8 encoded string with a length limit of 128
  // characters. Otherwise, an INVALID_ARGUMENT error is returned.
  string display_name = 2 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Required. The product level configuration.
  ProductLevelConfig product_level_config = 4
      [(google.api.field_behavior) = REQUIRED];
}
