// Code generated by sidekick. DO NOT EDIT.
//
// 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
//
//     https://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.

import Foundation
import GoogleCloudWkt

/// QuotaPreference represents the preferred quota configuration specified for
/// a project, folder or organization. There is only one QuotaPreference
/// resource for a quota value targeting a unique set of dimensions.
public struct QuotaPreference: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Required except in the CREATE requests.
  /// The resource name of the quota preference.
  /// The path that follows `/locations` must be `/global`.
  /// For example:
  /// `projects/123/locations/global/quotaPreferences/my-config-for-us-east1`
  public var name: Swift.String = Swift.String()

  /// Immutable. The dimensions that this quota preference applies to. The key of
  /// the map entry is the name of a dimension, such as `region`, `zone`,
  /// `network_id`, and the value of the map entry is the dimension value.
  ///
  /// If a dimension is missing from the map of dimensions, the quota preference
  /// applies to all the dimension values except for those that have other quota
  /// preferences configured for the specific value.
  ///
  /// Note: QuotaPreferences can only be applied across all values of `user` and
  /// `resource` dimension. Do not set values for `user` or `resource` in the
  /// dimension map.
  ///
  /// For example: `{"provider" : "Example Organization"}` where `provider` is a
  /// service-specific quota dimension and `Example Organization` is the provider
  /// name.
  public var dimensions: [Swift.String: Swift.String] = [:]

  /// Required. Preferred quota configuration.
  public var quotaConfig: QuotaConfig? = nil

  /// Optional. The current etag of the quota preference. If an etag is provided
  /// on update and does not match the current server's etag of the quota
  /// preference, the request will be blocked and an ABORTED error will be
  /// returned. See https://google.aip.dev/134#etags for more details on etags.
  public var etag: Swift.String = Swift.String()

  /// Output only. Create time stamp
  public var createTime: GoogleCloudWkt.Timestamp? = nil

  /// Output only. Update time stamp
  public var updateTime: GoogleCloudWkt.Timestamp? = nil

  /// Required. The name of the service to which the quota preference is applied.
  public var service: Swift.String = Swift.String()

  /// Required. The id of the quota to which the quota preference is applied. A
  /// quota name is unique in the service. For example, `CpusPerProjectPerRegion`
  public var quotaId: Swift.String = Swift.String()

  /// Output only. Is the quota preference pending Google Cloud approval and
  /// fulfillment.
  public var reconciling: Swift.Bool = Swift.Bool()

  /// The reason / justification for this quota preference.
  public var justification: Swift.String = Swift.String()

  /// Input only. An email address that can be used to contact the user, in case
  /// Google Cloud needs more information to make a decision before additional
  /// quota can be granted.
  ///
  /// When requesting a quota increase, the email address is required.
  /// When requesting a quota decrease, the email address is optional.
  /// For example, the email address is optional when the
  /// `QuotaConfig.preferred_value` is smaller than the
  /// `QuotaDetails.reset_value`.
  public var contactEmail: Swift.String = Swift.String()

  /// Initialize a new instance of `QuotaPreference`.
  public init() {}

  /// Use `config` to return a new instance of this object, with some fields updated.
  ///
  /// Commonly used to initialize the value, for example:
  ///
  /// ```
  /// let value = QuotaPreference().with { $0.name = ... }
  /// ```
  public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
    var copy = self
    try config(&copy)
    return copy
  }

  public static var _anyTypeUrl: Swift.String {
    return "type.googleapis.com/google.api.cloudquotas.v1.QuotaPreference"
  }
  public init(fromAny any: GoogleCloudWkt.`Any`) throws {
    self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
  }
  public func _pack() throws -> GoogleCloudWkt.Struct {
    return try GoogleCloudWkt._slowAnySerialize(message: self)
  }
}
