// 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/cloud/discoveryengine/v1beta/common.proto";
import "google/type/date.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 = "LicenseConfigProto";
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";

// Information about users' licenses.
message LicenseConfig {
  option (google.api.resource) = {
    type: "discoveryengine.googleapis.com/LicenseConfig"
    pattern: "projects/{project}/locations/{location}/licenseConfigs/{license_config}"
    plural: "licenseConfigs"
    singular: "licenseConfig"
  };

  // License config state enumeration.
  enum State {
    // Default value. The license config does not exist.
    STATE_UNSPECIFIED = 0;

    // The license config is effective and being used.
    ACTIVE = 1;

    // The license config has expired.
    EXPIRED = 2;

    // The license config has not started yet, and its start date is in the
    // future.
    NOT_STARTED = 3;

    // This is when a sub license config has returned all its seats back to
    // BillingAccountLicenseConfig that it belongs to.
    // Similar to EXPIRED.
    WITHDRAWN = 4;

    // The license config is terminated earlier than the expiration date and it
    // is deactivating. The customer will still have access in this state. It
    // will be converted to EXPIRED after the deactivating period ends (14 days)
    // or when the end date is reached, whichever comes first.
    DEACTIVATING = 5;
  }

  // Immutable. Identifier. The fully qualified resource name of the license
  // config. Format:
  // `projects/{project}/locations/{location}/licenseConfigs/{license_config}`
  string name = 1 [
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.field_behavior) = IDENTIFIER
  ];

  // Required. Number of licenses purchased.
  int64 license_count = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. Subscription tier information for the license config.
  SubscriptionTier subscription_tier = 3
      [(google.api.field_behavior) = REQUIRED];

  // Output only. The state of the license config.
  State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Whether the license config should be auto renewed when it reaches
  // the end date.
  bool auto_renew = 5 [(google.api.field_behavior) = OPTIONAL];

  // Required. The start date.
  google.type.Date start_date = 6 [(google.api.field_behavior) = REQUIRED];

  // Optional. The planed end date.
  google.type.Date end_date = 7 [(google.api.field_behavior) = OPTIONAL];

  // Required. Subscription term.
  SubscriptionTerm subscription_term = 8
      [(google.api.field_behavior) = REQUIRED];

  // Optional. Whether the license config is for free trial.
  bool free_trial = 9 [(google.api.field_behavior) = OPTIONAL];

  // Output only. Whether the license config is for Gemini bundle.
  bool gemini_bundle = 11 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Indication of whether the subscription is terminated earlier
  // than the expiration date. This is usually terminated by pipeline once the
  // subscription gets terminated from subsv3.
  bool early_terminated = 12 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The date when the subscription is terminated earlier than the
  // expiration date.
  google.type.Date early_termination_date = 13
      [(google.api.field_behavior) = OUTPUT_ONLY];
}
