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

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/commerceproducer/v1beta/private_offer.proto";

option csharp_namespace = "Google.Cloud.CommerceProducer.V1Beta";
option go_package = "cloud.google.com/go/commerceproducer/apiv1beta/commerceproducerpb;commerceproducerpb";
option java_multiple_files = true;
option java_outer_classname = "ServiceProto";
option java_package = "com.google.cloud.commerceproducer.v1beta";
option php_namespace = "Google\\Cloud\\CommerceProducer\\V1beta";
option ruby_package = "Google::Cloud::CommerceProducer::V1beta";

// Message describing Service resource.
message Service {
  option (google.api.resource) = {
    type: "commerceproducer.googleapis.com/Service"
    pattern: "projects/{project}/locations/{location}/services/{service}"
    plural: "services"
    singular: "service"
  };

  // Requirements and constraints for documents attached to private offers.
  message DocumentRequirement {
    // Requirement specification for a specific document type.
    message DocumentTypeRequirement {
      // Requirement level for the document type.
      enum RequirementLevel {
        // Unspecified requirement level. Do not use.
        REQUIREMENT_LEVEL_UNSPECIFIED = 0;

        // The document type is mandatory for private offers on this service.
        // Exactly one document of this type must be attached.
        REQUIRED = 1;

        // The document type is optional for private offers on this service.
        // At most one document of this type may be attached.
        OPTIONAL = 2;

        // The document type is not permitted for private offers on this
        // service. No document of this type may be attached.
        //
        // A document type omitted from `document_type_requirements` is also
        // not permitted. This value is used to state the restriction
        // explicitly.
        NOT_ALLOWED = 3;
      }

      // The document type.
      PrivateOfferDocument.DocumentType document_type = 1;

      // The requirement level for this document type.
      RequirementLevel requirement_level = 2;
    }

    // Document requirements for private offers on this service.
    //
    // Each document type appears at most once. The order of entries is not
    // significant. A document type that is not present in this list is not
    // permitted for private offers on this service.
    repeated DocumentTypeRequirement document_type_requirements = 1;
  }

  // The type of the product this service commercializes.
  //
  // Every service has a type, but only the types listed below are exposed. A
  // service whose type is not one of the listed values reports
  // `PRODUCT_TYPE_UNSPECIFIED`.
  //
  // Values may be added over time. Clients must handle unrecognized values.
  // When new values are added, the ProductType for an existing service may
  // change. Clients must also be able to handle a change in ProductType.
  enum ProductType {
    // The service has a type, but it is not one of the types exposed below.
    PRODUCT_TYPE_UNSPECIFIED = 0;

    // Represents a software-as-a-service product. See
    // https://docs.cloud.google.com/marketplace/docs/partners/integrated-saas
    SOFTWARE_AS_A_SERVICE = 1;

    // Represents a data product on BigQuery sharing (formerly Analytics Hub).
    // See https://docs.cloud.google.com/marketplace/docs/partners/data
    ANALYTICS_HUB_LISTING = 2;

    // Represents a professional services product. See
    // https://docs.cloud.google.com/marketplace/docs/partners/professional-services
    PROFESSIONAL_SERVICES = 3;
  }

  // Identifier. Name of resource.
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Output only. Title of the service.
  //
  // Not included for `SERVICE_VIEW_BASIC`.
  string title = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Document requirement for private offers on this service.
  //
  // Constraints that apply to every service, such as the restriction against
  // attaching both a standard and a custom EULA, are documented on
  // `PrivateOfferDocument` and are not represented here.
  DocumentRequirement document_requirement = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Type of the product this service commercializes.
  ProductType product_type = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}
