// 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/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 = "QuotaRuleProto";
option java_package = "com.google.cloud.netapp.v1";
option php_namespace = "Google\\Cloud\\NetApp\\V1";
option ruby_package = "Google::Cloud::NetApp::V1";

// ListQuotaRulesRequest for listing quota rules.
message ListQuotaRulesRequest {
  // Required. Parent value for ListQuotaRulesRequest
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "netapp.googleapis.com/QuotaRule"
    }
  ];

  // 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. Filtering results
  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];
}

// ListQuotaRulesResponse is the response to a ListQuotaRulesRequest.
message ListQuotaRulesResponse {
  // List of quota rules
  repeated QuotaRule quota_rules = 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;
}

// GetQuotaRuleRequest for getting a quota rule.
message GetQuotaRuleRequest {
  // Required. Name of the quota rule
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "netapp.googleapis.com/QuotaRule"
    }
  ];
}

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

  // Required. Fields of the to be created quota rule.
  QuotaRule quota_rule = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. ID of the quota rule to create. Must be unique within the parent
  // resource. Must contain only letters, numbers, underscore 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 quota_rule_id = 3 [(google.api.field_behavior) = REQUIRED];
}

// UpdateQuotaRuleRequest for updating a quota rule.
message UpdateQuotaRuleRequest {
  // Optional. Field mask is used to specify the fields to be overwritten in the
  // Quota Rule resource by the update.
  // The fields specified in the update_mask are relative to the resource, not
  // the full request. A field will be overwritten if it is in the mask. If the
  // user does not provide a mask then all fields will be overwritten.
  google.protobuf.FieldMask update_mask = 1
      [(google.api.field_behavior) = OPTIONAL];

  // Required. The quota rule being updated
  QuotaRule quota_rule = 2 [(google.api.field_behavior) = REQUIRED];
}

// DeleteQuotaRuleRequest for deleting a single quota rule.
message DeleteQuotaRuleRequest {
  // Required. Name of the quota rule.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "netapp.googleapis.com/QuotaRule"
    }
  ];
}

// QuotaRule specifies the maximum disk space a user or group can use within a
// volume. They can be used for creating default and individual quota rules.
message QuotaRule {
  option (google.api.resource) = {
    type: "netapp.googleapis.com/QuotaRule"
    pattern: "projects/{project}/locations/{location}/volumes/{volume}/quotaRules/{quota_rule}"
    plural: "quotaRules"
    singular: "quotaRule"
  };

  // Types of Quota Rule
  enum Type {
    // Unspecified type for quota rule
    TYPE_UNSPECIFIED = 0;

    // Individual user quota rule
    INDIVIDUAL_USER_QUOTA = 1;

    // Individual group quota rule
    INDIVIDUAL_GROUP_QUOTA = 2;

    // Default user quota rule
    DEFAULT_USER_QUOTA = 3;

    // Default group quota rule
    DEFAULT_GROUP_QUOTA = 4;
  }

  // Quota Rule states
  enum State {
    // Unspecified state for quota rule
    STATE_UNSPECIFIED = 0;

    // Quota rule is creating
    CREATING = 1;

    // Quota rule is updating
    UPDATING = 2;

    // Quota rule is deleting
    DELETING = 3;

    // Quota rule is ready
    READY = 4;

    // Quota rule is in error state.
    ERROR = 5;
  }

  // Identifier. The resource name of the quota rule.
  // Format:
  // `projects/{project_number}/locations/{location_id}/volumes/volumes/{volume_id}/quotaRules/{quota_rule_id}`.
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Optional. The quota rule applies to the specified user or group, identified
  // by a Unix UID/GID, Windows SID, or null for default.
  string target = 2 [(google.api.field_behavior) = OPTIONAL];

  // Required. The type of quota rule.
  Type type = 3 [(google.api.field_behavior) = REQUIRED];

  // Required. The maximum allowed disk space in MiB.
  int32 disk_limit_mib = 4 [(google.api.field_behavior) = REQUIRED];

  // Output only. State of the quota rule
  State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. State details of the quota rule
  string state_details = 7 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Create time of the quota rule
  google.protobuf.Timestamp create_time = 8
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Description of the quota rule
  string description = 9 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Labels of the quota rule
  map<string, string> labels = 10 [(google.api.field_behavior) = OPTIONAL];
}
