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

import "google/api/field_behavior.proto";

option csharp_namespace = "Google.Cloud.CapacityPlanner.V1Beta";
option go_package = "cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb;capacityplannerpb";
option java_multiple_files = true;
option java_outer_classname = "ResourceProto";
option java_package = "com.google.cloud.capacityplanner.v1beta";
option php_namespace = "Google\\Cloud\\CapacityPlanner\\V1beta";
option ruby_package = "Google::Cloud::CapacityPlanner::V1beta";

enum Unit {
  UNIT_UNSPECIFIED = 0;

  UNIT_COUNT = 1;

  // Kilobytes (10^3 bytes)
  KB = 2;

  // Gigabytes (10^9 bytes)
  GB = 3;

  // Terabytes (10^12 bytes)
  TB = 4;

  // Mebibytes (2^20 bytes)
  MIB = 17;

  // Gibibytes (2^30 bytes)
  GIB = 5;

  // Tebibytes (2^40 bytes)
  TIB = 6;

  // Queries per second
  QPS = 7;

  // Megabytes (10^6 bytes)
  MB = 8;

  // Pebibytes (2^50 bytes)
  PIB = 9;

  // Terabits (10^12 bits) per second
  TBPS = 10 [deprecated = true];

  GBPS_BITS = 11;

  GIB_BITS = 12;

  MBPS_BITS = 13;

  MBPS_BYTES = 14;

  TBPS_BITS = 15;

  TBPS_BYTES = 16;

  KOPS = 18;
}

// The resource container of Google Cloud Platform hierarchy such as a project.
message ResourceContainer {
  enum Type {
    TYPE_UNSPECIFIED = 0;

    PROJECT = 1;

    FOLDER = 2;

    ORG = 3;
  }

  Type type = 1;

  // Required. Identifier of the resource container. For example, project number
  // for project type.
  string id = 2 [(google.api.field_behavior) = REQUIRED];
}

// The id for a Google Cloud Platform resource key.
message ResourceIdKey {
  // Demand fields for the resource.
  oneof demand_fields {
    // Required. resource_code for the resource. eg: gce-ram, gce-vcpus,
    // gce-gpu, gce-tpu, gce-vm, gce-persistent-disk, gce-local-ssd.
    string resource_code = 2 [(google.api.field_behavior) = REQUIRED];
  }

  // Required. Id of the resource.
  ResourceIdentifier resource_id = 1 [(google.api.field_behavior) = REQUIRED];
}

// The identifier for a Google Cloud Platform resource.
message ResourceIdentifier {
  string service_name = 1;

  string resource_name = 2;

  repeated ResourceAttribute resource_attributes = 3;
}

// An attribute of a Google Cloud Platform resource.
message ResourceAttribute {
  string key = 1;

  ResourceValue value = 2;
}

message ResourceValue {
  Unit unit = 1;

  Value value = 2;
}

message Value {
  oneof value {
    int64 int64_value = 1;

    string string_value = 2;

    double double_value = 3;

    bool bool_value = 4;
  }
}
