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

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

option csharp_namespace = "Google.Cloud.HypercomputeCluster.V1";
option go_package = "cloud.google.com/go/hypercomputecluster/apiv1/hypercomputeclusterpb;hypercomputeclusterpb";
option java_multiple_files = true;
option java_outer_classname = "OperationMetadataProto";
option java_package = "com.google.cloud.hypercomputecluster.v1";
option php_namespace = "Google\\Cloud\\HypercomputeCluster\\V1";
option ruby_package = "Google::Cloud::HypercomputeCluster::V1";
option (google.api.resource_definition) = {
  type: "lustre.googleapis.com/Instance"
  pattern: "projects/{project}/locations/{location}/instances/{instance}"
};

// Represents the metadata of the long-running operation.
message OperationMetadata {
  // Output only. The time the operation was created.
  google.protobuf.Timestamp create_time = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time the operation finished running.
  google.protobuf.Timestamp end_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Server-defined resource path for the target of the operation.
  string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Name of the verb executed by the operation.
  string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Identifies whether the user has requested cancellation
  // of the operation. Operations that have been cancelled successfully
  // have
  // [google.longrunning.Operation.error][google.longrunning.Operation.error]
  // value with a [google.rpc.Status.code][google.rpc.Status.code] of `1`,
  // corresponding to `Code.CANCELLED`.
  bool requested_cancellation = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. API version used to start the operation.
  string api_version = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Progress of the operation.
  OperationProgress progress = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Message describing the progress of a cluster mutation long-running operation.
message OperationProgress {
  // Output only. Steps and status of the operation.
  repeated OperationStep steps = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Message describing the status of a single step in a cluster mutation
// long-running operation.
message OperationStep {
  // State of the operation step.
  enum State {
    // Unspecified state.
    STATE_UNSPECIFIED = 0;

    // Initial state before step execution starts.
    WAITING = 1;

    // Step execution is running in progress.
    IN_PROGRESS = 2;

    // Step execution is completed.
    DONE = 3;
  }

  // Step of the operation.
  oneof type {
    // Output only. If set, indicates that new network creation is part of the
    // operation.
    CreateNetwork create_network = 2
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that new private service access creation
    // is part of the operation.
    CreatePrivateServiceAccess create_private_service_access = 3
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that new Filestore instance creation is
    // part of the operation.
    CreateFilestoreInstance create_filestore_instance = 4
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that new Cloud Storage bucket creation is
    // part of the operation.
    CreateStorageBucket create_storage_bucket = 5
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that new Lustre instance creation is part
    // of the operation.
    CreateLustreInstance create_lustre_instance = 6
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that orchestrator creation is part of the
    // operation.
    CreateOrchestrator create_orchestrator = 8
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that new nodeset creation is part of the
    // operation.
    CreateNodeset create_nodeset = 9
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that new partition creation is part of the
    // operation.
    CreatePartition create_partition = 10
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that new login node creation is part of
    // the operation.
    CreateLoginNode create_login_node = 11
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that cluster health check is part of the
    // operation.
    CheckClusterHealth check_cluster_health = 12
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that an orchestrator update is part of the
    // operation.
    UpdateOrchestrator update_orchestrator = 13
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that nodeset update is part of the
    // operation.
    UpdateNodeset update_nodeset = 14
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that partition update is part of the
    // operation.
    UpdatePartition update_partition = 15
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that login node update is part of the
    // operation.
    UpdateLoginNode update_login_node = 16
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that orchestrator deletion is part of the
    // operation.
    DeleteOrchestrator delete_orchestrator = 18
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that nodeset deletion is part of the
    // operation.
    DeleteNodeset delete_nodeset = 19
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that partition deletion is part of the
    // operation.
    DeletePartition delete_partition = 20
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that login node deletion is part of the
    // operation.
    DeleteLoginNode delete_login_node = 21
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that Filestore instance deletion is part
    // of the operation.
    DeleteFilestoreInstance delete_filestore_instance = 22
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that Cloud Storage bucket deletion is part
    // of the operation.
    DeleteStorageBucket delete_storage_bucket = 23
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that Lustre instance deletion is part of
    // the operation.
    DeleteLustreInstance delete_lustre_instance = 24
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that private service access deletion is
    // part of the operation.
    DeletePrivateServiceAccess delete_private_service_access = 25
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. If set, indicates that network deletion is part of the
    // operation.
    DeleteNetwork delete_network = 26
        [(google.api.field_behavior) = OUTPUT_ONLY];
  }

  // Output only. State of the operation step.
  State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// When set in OperationStep, indicates that a new network should be created.
message CreateNetwork {
  // Output only. Name of the network to create, in the format
  // `projects/{project}/global/networks/{network}`.
  string network = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "compute.googleapis.com/Network" }
  ];
}

// When set in OperationStep, indicates that a new private service access should
// be created.
message CreatePrivateServiceAccess {}

// When set in OperationStep, indicates that a new filestore instance should be
// created.
message CreateFilestoreInstance {
  // Output only. Name of the Filestore instance, in the format
  // `projects/{project}/locations/{location}/instances/{instance}`
  string filestore = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "file.googleapis.com/FileInstance"
    }
  ];
}

// When set in OperationStep, indicates that a new storage bucket should be
// created.
message CreateStorageBucket {
  // Output only. Name of the bucket.
  string bucket = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "storage.googleapis.com/Bucket" }
  ];
}

// When set in OperationStep, indicates that a new lustre instance should be
// created.
message CreateLustreInstance {
  // Output only. Name of the Managed Lustre instance, in the format
  // `projects/{project}/locations/{location}/instances/{instance}`
  string lustre = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "lustre.googleapis.com/Instance" }
  ];
}

// When set in OperationStep, indicates that an orchestrator should be created.
message CreateOrchestrator {}

// When set in OperationStep, indicates that a nodeset should be created.
message CreateNodeset {
  // Output only. Name of the nodeset to create
  repeated string nodesets = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// When set in OperationStep, indicates that a partition should be created.
message CreatePartition {
  // Output only. Name of the partition to create
  repeated string partitions = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// When set in OperationStep, indicates that a login node should be created.
message CreateLoginNode {}

// When set in OperationStep, indicates that cluster health check should be
// performed.
message CheckClusterHealth {}

// When set in OperationStep, indicates that an orchestrator should be updated.
message UpdateOrchestrator {}

// When set in OperationStep, indicates that a nodeset should be updated.
message UpdateNodeset {
  // Output only. Name of the nodeset to update
  repeated string nodesets = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// When set in OperationStep, indicates that a partition should be updated.
message UpdatePartition {
  // Output only. Name of the partition to update
  repeated string partitions = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// When set in OperationStep, indicates that a login node should be updated.
message UpdateLoginNode {}

// When set in OperationStep, indicates that an orchestrator should be deleted.
message DeleteOrchestrator {}

// When set in OperationStep, indicates that a nodeset should be deleted.
message DeleteNodeset {
  // Output only. Name of the nodeset to delete
  repeated string nodesets = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// When set in OperationStep, indicates that a partition should be deleted.
message DeletePartition {
  // Output only. Name of the partition to delete
  repeated string partitions = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// When set in OperationStep, indicates that a login node should be deleted.
message DeleteLoginNode {}

// When set in OperationStep, indicates that a Filestore instance should be
// deleted.
message DeleteFilestoreInstance {
  // Output only. Name of the Filestore instance, in the format
  // `projects/{project}/locations/{location}/instances/{instance}`
  string filestore = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "file.googleapis.com/FileInstance"
    }
  ];
}

// When set in OperationStep, indicates that Cloud Storage bucket should be
// deleted.
message DeleteStorageBucket {
  // Output only. Name of the bucket.
  string bucket = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "storage.googleapis.com/Bucket" }
  ];
}

// When set in OperationStep, indicates that a Lustre instance should be
// deleted.
message DeleteLustreInstance {
  // Output only. Name of the Managed Lustre instance, in the format
  // `projects/{project}/locations/{location}/instances/{instance}`
  string lustre = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "lustre.googleapis.com/Instance" }
  ];
}

// When set in OperationStep, indicates private service access deletion
// step.
message DeletePrivateServiceAccess {}

// When set in OperationStep, indicates network deletion step with the
// resource name.
message DeleteNetwork {
  // Output only. Name of the network to delete, in the format
  // `projects/{project}/global/networks/{network}`.
  string network = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "compute.googleapis.com/Network" }
  ];
}
