// 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.productregistry.v1;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/productregistry/v1/lifecycle_state.proto";

option csharp_namespace = "Google.Cloud.ProductRegistry.V1";
option go_package = "cloud.google.com/go/productregistry/apiv1/productregistrypb;productregistrypb";
option java_multiple_files = true;
option java_outer_classname = "LogicalProductProto";
option java_package = "com.google.cloud.productregistry.v1";
option php_namespace = "Google\\Cloud\\ProductRegistry\\V1";
option ruby_package = "Google::Cloud::ProductRegistry::V1";

// Represents an independent service offering that can be
// provisioned by a customer.
message LogicalProduct {
  option (google.api.resource) = {
    type: "cloudproductregistry.googleapis.com/LogicalProduct"
    pattern: "logicalProducts/{logical_product}"
    plural: "logicalProducts"
    singular: "logicalProduct"
  };

  // Identifier. The resource name of the LogicalProduct.
  // Format: logicalProducts/{logical_product}.
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Display name of the LogicalProduct.
  string title = 2;

  // Product suite associated with the logical product.
  // Format: productSuites/{product_suite}.
  string product_suite = 3 [(google.api.resource_reference) = {
    type: "cloudproductregistry.googleapis.com/ProductSuite"
  }];

  // Output only. Child variant resource references.
  // Format: logicalProducts/{logical_product}/variants/{variant}
  repeated string variants = 4 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "cloudproductregistry.googleapis.com/LogicalProductVariant"
    }
  ];

  // Output only. Current Lifecycle state of the logical product.
  LifecycleState lifecycle_state = 5
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Indicates whether the logical product has been replaced. If
  // `false`, the product is active. If `true`, the product has been replaced by
  // another type, and the `replacement` field contains the resource name of
  // that replacement.
  bool replaced = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The resource name of the Logical Entity that the logical
  // product is replaced by. This field is only populated when this logical
  // product is replaced by some other type. Eg:
  // logicalProducts/{logical_product}/variants/{variant},
  // productSuites/{product_suite}, etc.
  string replacement = 7 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "*" }
  ];
}
