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

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1";
option go_package = "cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepb";
option java_multiple_files = true;
option java_outer_classname = "UserLicenseProto";
option java_package = "com.google.cloud.discoveryengine.v1";
option objc_class_prefix = "DISCOVERYENGINE";
option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1";
option ruby_package = "Google::Cloud::DiscoveryEngine::V1";

// User License information assigned by the admin.
message UserLicense {
  // License assignment state enumeration.
  enum LicenseAssignmentState {
    // Default value.
    LICENSE_ASSIGNMENT_STATE_UNSPECIFIED = 0;

    // License assigned to the user.
    ASSIGNED = 1;

    // No license assigned to the user.
    // Deprecated, translated to NO_LICENSE.
    UNASSIGNED = 2;

    // No license assigned to the user.
    NO_LICENSE = 3;

    // User attempted to login but no license assigned to the user.
    // This state is only used for no user first time login attempt but cannot
    // get license assigned.
    // Users already logged in but cannot get license assigned will be assigned
    // NO_LICENSE state(License could be unassigned by admin).
    NO_LICENSE_ATTEMPTED_LOGIN = 4;
  }

  // Required. Immutable. The user principal of the User, could be email address
  // or other prinical identifier. This field is immutable. Admin assign
  // licenses based on the user principal.
  string user_principal = 1 [
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.field_behavior) = REQUIRED
  ];

  // Optional. The user profile.
  // We user user full name(First name + Last name) as user profile.
  string user_profile = 3 [(google.api.field_behavior) = OPTIONAL];

  // Output only. License assignment state of the user.
  // If the user is assigned with a license config, the user loggin will be
  // assigned with the license;
  // If the user's license assignment state is unassigned or unspecified, no
  // license config will be associated to the user;
  LicenseAssignmentState license_assignment_state = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The full resource name of the Subscription(LicenseConfig)
  // assigned to the user.
  string license_config = 5 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = {
      type: "discoveryengine.googleapis.com/LicenseConfig"
    }
  ];

  // Output only. User created timestamp.
  google.protobuf.Timestamp create_time = 6
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. User update timestamp.
  google.protobuf.Timestamp update_time = 7
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. User last logged in time.
  // If the user has not logged in yet, this field will be empty.
  google.protobuf.Timestamp last_login_time = 8
      [(google.api.field_behavior) = OUTPUT_ONLY];
}
