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

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/netapp/v1/common.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.NetApp.V1";
option go_package = "cloud.google.com/go/netapp/apiv1/netapppb;netapppb";
option java_multiple_files = true;
option java_outer_classname = "HostGroupProto";
option java_package = "com.google.cloud.netapp.v1";
option php_namespace = "Google\\Cloud\\NetApp\\V1";
option ruby_package = "Google::Cloud::NetApp::V1";

// ListHostGroupsRequest for listing host groups.
message ListHostGroupsRequest {
  // Required. Parent value for ListHostGroupsRequest
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "netapp.googleapis.com/HostGroup"
    }
  ];

  // Optional. Requested page size. Server may return fewer items than
  // requested. If unspecified, the server will pick an appropriate default.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A token identifying a page of results the server should return.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Filter to apply to the request.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Hint for how to order the results
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// ListHostGroupsResponse is the response to a ListHostGroupsRequest.
message ListHostGroupsResponse {
  // The list of host groups.
  repeated HostGroup host_groups = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;

  // Locations that could not be reached.
  repeated string unreachable = 3;
}

// GetHostGroupRequest for getting a host group.
message GetHostGroupRequest {
  // Required. The resource name of the host group.
  // Format:
  // `projects/{project_number}/locations/{location_id}/hostGroups/{host_group_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "netapp.googleapis.com/HostGroup"
    }
  ];
}

// CreateHostGroupRequest for creating a host group.
message CreateHostGroupRequest {
  // Required. Parent value for CreateHostGroupRequest
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "netapp.googleapis.com/HostGroup"
    }
  ];

  // Required. Fields of the host group to create.
  HostGroup host_group = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. ID of the host group to create. Must be unique within the parent
  // resource. Must contain only letters, numbers, and hyphen, with
  // the first character a letter or underscore, the last a letter or underscore
  // or a number, and a 63 character maximum.
  string host_group_id = 3 [(google.api.field_behavior) = REQUIRED];
}

// UpdateHostGroupRequest for updating a host group.
message UpdateHostGroupRequest {
  // Required. The host group to update.
  // The host group's `name` field is used to identify the host group.
  // Format:
  // `projects/{project_number}/locations/{location_id}/hostGroups/{host_group_id}`.
  HostGroup host_group = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. The list of fields to update.
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = OPTIONAL];
}

// DeleteHostGroupRequest for deleting a single host group.
message DeleteHostGroupRequest {
  // Required. The resource name of the host group.
  // Format:
  // `projects/{project_number}/locations/{location_id}/hostGroups/{host_group_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "netapp.googleapis.com/HostGroup"
    }
  ];
}

// Host group is a collection of hosts that can be used for accessing a Block
// Volume.
message HostGroup {
  option (google.api.resource) = {
    type: "netapp.googleapis.com/HostGroup"
    pattern: "projects/{project}/locations/{location}/hostGroups/{host_group}"
    plural: "hostGroups"
    singular: "hostGroup"
  };

  // Types of host group.
  enum Type {
    // Unspecified type for host group.
    TYPE_UNSPECIFIED = 0;

    // iSCSI initiator host group.
    ISCSI_INITIATOR = 1;
  }

  // Host group states.
  enum State {
    // Unspecified state for host group.
    STATE_UNSPECIFIED = 0;

    // Host group is creating.
    CREATING = 1;

    // Host group is ready.
    READY = 2;

    // Host group is updating.
    UPDATING = 3;

    // Host group is deleting.
    DELETING = 4;

    // Host group is disabled.
    DISABLED = 5;
  }

  // Identifier. The resource name of the host group.
  // Format:
  // `projects/{project_number}/locations/{location_id}/hostGroups/{host_group_id}`.
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Required. Type of the host group.
  Type type = 2 [(google.api.field_behavior) = REQUIRED];

  // Output only. State of the host group.
  State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Create time of the host group.
  google.protobuf.Timestamp create_time = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Required. The list of hosts associated with the host group.
  repeated string hosts = 5 [(google.api.field_behavior) = REQUIRED];

  // Required. The OS type of the host group. It indicates the type of operating
  // system used by all of the hosts in the HostGroup. All hosts in a HostGroup
  // must be of the same OS type. This can be set only when creating a
  // HostGroup.
  OsType os_type = 6 [(google.api.field_behavior) = REQUIRED];

  // Optional. Description of the host group.
  string description = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Labels of the host group.
  map<string, string> labels = 8 [(google.api.field_behavior) = OPTIONAL];
}
