// 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

/// The inputs, outputs, and detailed explanation of the Autoscaling
/// recommendation.
public struct AutoscalerRecommendation: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// The autoscaling algorithm inputs.
  public var inputs: AutoscalerRecommendation.Inputs? = nil

  /// The algorithm outputs for the recommended cluster size.
  public var outputs: AutoscalerRecommendation.Outputs? = nil

  /// Initialize a new instance of `AutoscalerRecommendation`.
  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 = AutoscalerRecommendation().with { $0.inputs = ... }
  /// ```
  public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
    var copy = self
    try config(&copy)
    return copy
  }

  /// The input values for the Autoscaling recommendation algorithm.
  public struct Inputs: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The metrics collected by the Dataproc agent running on the cluster.
    /// For example, {"avg-yarn-pending-memory": "1040 MB"}
    public var clusterMetrics: [Swift.String: Swift.String] = [:]

    /// The cluster configuration before updating the cluster.
    public var currentClusterSize: ClusterSize? = nil

    /// The minimum worker counts for each instance group.
    public var minWorkerCounts: ClusterSize? = nil

    /// The maximum worker counts for each instance group.
    public var maxWorkerCounts: ClusterSize? = nil

    /// Initialize a new instance of `Inputs`.
    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 = Inputs().with { $0.clusterMetrics = ... }
    /// ```
    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.cloud.dataproc.logging.AutoscalerRecommendation.Inputs"
    }
    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)
    }
  }

  /// Autoscaler recommendations.
  public struct Outputs: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The high-level autoscaling decision, such as SCALE_UP, SCALE_DOWN,
    /// NO_OP.
    public var decision: ScalingDecisionType = ScalingDecisionType()

    /// The recommended cluster size.
    public var recommendedClusterSize: ClusterSize? = nil

    /// The graceful decommission timeout for downscaling operations.
    public var gracefulDecommissionTimeout: GoogleCloudWkt.Duration? = nil

    /// Reasons why the Autoscaler didn't add or remove more workers.
    public var constraintsReached: [ConstrainingFactor] = []

    /// Less significant recommendations that are not included in the
    /// `AutoscalerStatus.details` message.
    public var additionalRecommendationDetails: [Swift.String] = []

    /// A unique id for this recommendation that should be included when opening
    /// a support ticket.
    public var recommendationId: Swift.String = Swift.String()

    /// The metric source deciding the autoscaling recommendation.
    public var decisionMetric: MetricType = MetricType()

    /// Initialize a new instance of `Outputs`.
    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 = Outputs().with { $0.decision = ... }
    /// ```
    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.cloud.dataproc.logging.AutoscalerRecommendation.Outputs"
    }
    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)
    }
  }

  public static var _anyTypeUrl: Swift.String {
    return "type.googleapis.com/google.cloud.dataproc.logging.AutoscalerRecommendation"
  }
  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)
  }
}
