// 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/protobuf/timestamp.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 = "StandardOfferProto";
option java_package = "com.google.cloud.commerceproducer.v1beta";
option php_namespace = "Google\\Cloud\\CommerceProducer\\V1beta";
option ruby_package = "Google::Cloud::CommerceProducer::V1beta";

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

  // Price model of the offer.
  message PriceModel {
    // A collection of SKUs.
    message SkuList {
      // Output only. List of SKUs by name.
      repeated string skus = 1 [
        (google.api.field_behavior) = OUTPUT_ONLY,
        (google.api.resource_reference) = {
          type: "commerceproducer.googleapis.com/Sku"
        }
      ];
    }

    // A collection of SkuGroups.
    message SkuGroupList {
      // Output only. List of SkuGroups by name.
      repeated string sku_groups = 1 [
        (google.api.field_behavior) = OUTPUT_ONLY,
        (google.api.resource_reference) = {
          type: "commerceproducer.googleapis.com/SkuGroup"
        }
      ];
    }

    // Price configurations for the usage part.
    message Usage {
      // The SKUs that the offer's usage fees are charged against.
      oneof skus {
        // Output only. The offer's usage fees are charged against these SKUs.
        SkuList sku_list = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

        // Output only. The offer's usage fees are charged against the SKUs in
        // these groups.
        SkuGroupList sku_group_list = 2
            [(google.api.field_behavior) = OUTPUT_ONLY];
      }
    }

    // Price configurations for flat fee subscriptions.
    message FlatFeeSubscription {
      // Output only. Flat fee subscription SKU for the offer.
      string sku = 1 [
        (google.api.field_behavior) = OUTPUT_ONLY,
        (google.api.resource_reference) = {
          type: "commerceproducer.googleapis.com/Sku"
        }
      ];
    }

    // Price configurations for the subscription part.
    oneof subscription {
      // Output only. Price configurations for the flat fee subscription.
      FlatFeeSubscription flat_fee = 2
          [(google.api.field_behavior) = OUTPUT_ONLY];
    }

    // Output only. Price configurations for the usage part.
    Usage usage = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  }

  // Term of the offer.
  // Applicable only to subscription offers.
  oneof term {
    // Output only. Term duration of the offer in months.
    // Applicable only to offers with a subscription price model.
    // Additional forms of offer term may be added in the future.
    int32 term_duration_months = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  }

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

  // Output only. Creation time of the offer.
  google.protobuf.Timestamp create_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Last update time of the offer.
  google.protobuf.Timestamp update_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Effective time of the offer.
  // Prior to this time, the offer cannot be purchased or used as the base
  // standard offer of a private offer.
  google.protobuf.Timestamp effective_time = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Expire time of the offer.
  // An offer is expired if its expire time is in the past.
  // An expired standard offer cannot be purchased or used as the base standard
  // offer of a private offer.
  google.protobuf.Timestamp expire_time = 5
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Identifier that distinguishes between different service levels
  // of the same product that constitute distinct offerings to customers with
  // different pricing.
  //
  // The service levels of a product are also referred to in some cases as the
  // product's 'plans', and the `service_level` value is referred to in some
  // cases as the "plan ID".
  //
  // Multiple non-expired standard offers can share the same service level when
  // they are subscription offers for different term durations.
  string service_level = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Title of the service level.
  //
  // Not included for `STANDARD_OFFER_VIEW_BASIC`.
  string service_level_title = 9 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Price model of the offer.
  PriceModel price_model = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
}
