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

#if FutureReservations
  import Foundation
  import GoogleCloudWkt

  /// [Output only] Represents status related to the future reservation.
  public struct FutureReservationStatus: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Output only. [Output Only] The current status of the requested amendment.
    public var amendmentStatus: FutureReservationStatus.AmendmentStatus? = nil

    /// Output only. Fully qualified urls of the automatically created reservations at
    /// start_time.
    public var autoCreatedReservations: [Swift.String] = []

    /// Output only. [Output Only] Represents the existing matching usage for the future
    /// reservation.
    public var existingMatchingUsageInfo: FutureReservationStatusExistingMatchingUsageInfo? = nil

    /// Output only. This count indicates the fulfilled capacity so far. This is set during
    /// "PROVISIONING" state. This count also includes capacity delivered as part
    /// of existing matching reservations.
    public var fulfilledCount: Swift.Int64? = nil

    /// Output only. [Output Only] This field represents the future reservation before an
    /// amendment was requested. If the amendment is declined, the Future
    /// Reservation will be reverted to the last known good state. The last known
    /// good state is not set when updating a future reservation whose
    /// Procurement Status is DRAFTING.
    public var lastKnownGoodState: FutureReservationStatusLastKnownGoodState? = nil

    /// Output only. Time when Future Reservation would become LOCKED, after which no
    /// modifications to Future Reservation will be allowed. Applicable only
    /// after the Future Reservation is in the APPROVED state. The lock_time is
    /// an RFC3339 string. The procurement_status will transition to PROCURING
    /// state at this time.
    public var lockTime: Swift.String? = nil

    /// Output only. Current state of this Future Reservation
    public var procurementStatus: FutureReservationStatus.ProcurementStatus? = nil

    public var specificSkuProperties: FutureReservationStatusSpecificSKUProperties? = nil

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

    /// The enumerated type for the [amendmentStatus][google.cloud.compute.v1.FutureReservationStatus.amendmentStatus] field.
    ///
    /// [google.cloud.compute.v1.FutureReservationStatus.amendmentStatus]: <doc:FutureReservationStatus/AmendmentStatus>
    public enum AmendmentStatus: Codable, Equatable, Sendable {
      /// The requested amendment to the Future Resevation has been approved and
      /// applied by GCP.
      case amendmentApproved
      /// The requested amendment to the Future Reservation has been declined by
      /// GCP and the original state was restored.
      case amendmentDeclined
      /// The requested amendment to the Future Reservation is currently being
      /// reviewd by GCP.
      case amendmentInReview
      case unspecified
      /// Encodes an unknown integer value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownIntValue(Int)
      /// Encodes an unknown string value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownStringValue(String)

      public init() {
        self = .amendmentApproved
      }

      /// Returns the integer value associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown string value, this returns `nil`.
      public var intValue: Int? {
        switch self {
        case .amendmentApproved: return 0
        case .amendmentDeclined: return 1
        case .amendmentInReview: return 2
        case .unspecified: return 3
        case .unknownIntValue(let v): return v
        case .unknownStringValue: return nil
        }
      }

      /// Returns the string value (or name) associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
      public var stringValue: Swift.String? {
        switch self {
        case .amendmentApproved: return "AMENDMENT_APPROVED"
        case .amendmentDeclined: return "AMENDMENT_DECLINED"
        case .amendmentInReview: return "AMENDMENT_IN_REVIEW"
        case .unspecified: return "AMENDMENT_STATUS_UNSPECIFIED"
        case .unknownIntValue: return nil
        case .unknownStringValue(let v): return v
        }
      }

      /// Initialize from a string value.
      ///
      /// If the value is unknown, this initializes to [`unknownStringValue`](doc:AmendmentStatus/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "AMENDMENT_APPROVED": self = .amendmentApproved
        case "AMENDMENT_DECLINED": self = .amendmentDeclined
        case "AMENDMENT_IN_REVIEW": self = .amendmentInReview
        case "AMENDMENT_STATUS_UNSPECIFIED": self = .unspecified
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:AmendmentStatus/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .amendmentApproved
        case 1: self = .amendmentDeclined
        case 2: self = .amendmentInReview
        case 3: self = .unspecified
        default: self = .unknownIntValue(intValue)
        }
      }

      public init(from decoder: Decoder) throws {
        let container = try decoder.singleValueContainer()
        if let v = try? container.decode(Int.self) {
          self.init(intValue: v)
          return
        }
        if let s = try? container.decode(String.self) {
          if let v = Int(s) {
            self.init(intValue: v)
          } else {
            self.init(stringValue: s)
          }
          return
        }
        throw DecodingError.dataCorruptedError(
          in: container, debugDescription: "Expected enum value, must be integer or string.")
      }

      public func encode(to encoder: Encoder) throws {
        var container = encoder.singleValueContainer()
        switch self {
        case .amendmentApproved: return try container.encode(0)
        case .amendmentDeclined: return try container.encode(1)
        case .amendmentInReview: return try container.encode(2)
        case .unspecified: return try container.encode(3)
        case .unknownIntValue(let v): return try container.encode(v)
        case .unknownStringValue(let v): return try container.encode(v)
        }
      }
    }

    /// The enumerated type for the [procurementStatus][google.cloud.compute.v1.FutureReservationStatus.procurementStatus] field.
    ///
    /// [google.cloud.compute.v1.FutureReservationStatus.procurementStatus]: <doc:FutureReservationStatus/ProcurementStatus>
    public enum ProcurementStatus: Codable, Equatable, Sendable {
      /// Future reservation is approved by GCP.
      case approved
      /// Future reservation is cancelled by the customer.
      case cancelled
      /// Future reservation is committed by the customer.
      case committed
      /// Future reservation is rejected by GCP.
      case declined
      /// Related status for PlanningStatus.Draft. Transitions to
      /// PENDING_APPROVAL upon user submitting FR.
      case drafting
      /// Future reservation failed. No additional reservations were provided.
      case failed
      /// Future reservation is partially fulfilled. Additional reservations were
      /// provided but did not reach total_count reserved instance slots.
      case failedPartiallyFulfilled
      /// Future reservation is fulfilled completely.
      case fulfilled
      /// An Amendment to the Future Reservation has been requested. If the
      /// Amendment is declined, the Future Reservation will be restored to the
      /// last known good state.
      case pendingAmendmentApproval
      /// Future reservation is pending approval by GCP.
      case pendingApproval
      case unspecified
      /// Future reservation is being procured by GCP. Beyond this point, Future
      /// reservation is locked and no further modifications are allowed.
      case procuring
      /// Future reservation capacity is being provisioned. This state will be
      /// entered after start_time, while reservations are being created to
      /// provide total_count reserved instance slots. This state will not
      /// persist past start_time + 24h.
      case provisioning
      /// Encodes an unknown integer value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownIntValue(Int)
      /// Encodes an unknown string value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownStringValue(String)

      public init() {
        self = .approved
      }

      /// Returns the integer value associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown string value, this returns `nil`.
      public var intValue: Int? {
        switch self {
        case .approved: return 0
        case .cancelled: return 1
        case .committed: return 2
        case .declined: return 3
        case .drafting: return 4
        case .failed: return 5
        case .failedPartiallyFulfilled: return 6
        case .fulfilled: return 7
        case .pendingAmendmentApproval: return 8
        case .pendingApproval: return 9
        case .unspecified: return 10
        case .procuring: return 11
        case .provisioning: return 12
        case .unknownIntValue(let v): return v
        case .unknownStringValue: return nil
        }
      }

      /// Returns the string value (or name) associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
      public var stringValue: Swift.String? {
        switch self {
        case .approved: return "APPROVED"
        case .cancelled: return "CANCELLED"
        case .committed: return "COMMITTED"
        case .declined: return "DECLINED"
        case .drafting: return "DRAFTING"
        case .failed: return "FAILED"
        case .failedPartiallyFulfilled: return "FAILED_PARTIALLY_FULFILLED"
        case .fulfilled: return "FULFILLED"
        case .pendingAmendmentApproval: return "PENDING_AMENDMENT_APPROVAL"
        case .pendingApproval: return "PENDING_APPROVAL"
        case .unspecified: return "PROCUREMENT_STATUS_UNSPECIFIED"
        case .procuring: return "PROCURING"
        case .provisioning: return "PROVISIONING"
        case .unknownIntValue: return nil
        case .unknownStringValue(let v): return v
        }
      }

      /// Initialize from a string value.
      ///
      /// If the value is unknown, this initializes to [`unknownStringValue`](doc:ProcurementStatus/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "APPROVED": self = .approved
        case "CANCELLED": self = .cancelled
        case "COMMITTED": self = .committed
        case "DECLINED": self = .declined
        case "DRAFTING": self = .drafting
        case "FAILED": self = .failed
        case "FAILED_PARTIALLY_FULFILLED": self = .failedPartiallyFulfilled
        case "FULFILLED": self = .fulfilled
        case "PENDING_AMENDMENT_APPROVAL": self = .pendingAmendmentApproval
        case "PENDING_APPROVAL": self = .pendingApproval
        case "PROCUREMENT_STATUS_UNSPECIFIED": self = .unspecified
        case "PROCURING": self = .procuring
        case "PROVISIONING": self = .provisioning
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:ProcurementStatus/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .approved
        case 1: self = .cancelled
        case 2: self = .committed
        case 3: self = .declined
        case 4: self = .drafting
        case 5: self = .failed
        case 6: self = .failedPartiallyFulfilled
        case 7: self = .fulfilled
        case 8: self = .pendingAmendmentApproval
        case 9: self = .pendingApproval
        case 10: self = .unspecified
        case 11: self = .procuring
        case 12: self = .provisioning
        default: self = .unknownIntValue(intValue)
        }
      }

      public init(from decoder: Decoder) throws {
        let container = try decoder.singleValueContainer()
        if let v = try? container.decode(Int.self) {
          self.init(intValue: v)
          return
        }
        if let s = try? container.decode(String.self) {
          if let v = Int(s) {
            self.init(intValue: v)
          } else {
            self.init(stringValue: s)
          }
          return
        }
        throw DecodingError.dataCorruptedError(
          in: container, debugDescription: "Expected enum value, must be integer or string.")
      }

      public func encode(to encoder: Encoder) throws {
        var container = encoder.singleValueContainer()
        switch self {
        case .approved: return try container.encode(0)
        case .cancelled: return try container.encode(1)
        case .committed: return try container.encode(2)
        case .declined: return try container.encode(3)
        case .drafting: return try container.encode(4)
        case .failed: return try container.encode(5)
        case .failedPartiallyFulfilled: return try container.encode(6)
        case .fulfilled: return try container.encode(7)
        case .pendingAmendmentApproval: return try container.encode(8)
        case .pendingApproval: return try container.encode(9)
        case .unspecified: return try container.encode(10)
        case .procuring: return try container.encode(11)
        case .provisioning: return try container.encode(12)
        case .unknownIntValue(let v): return try container.encode(v)
        case .unknownStringValue(let v): return try container.encode(v)
        }
      }
    }

    public static var _anyTypeUrl: Swift.String {
      return "type.googleapis.com/google.cloud.compute.v1.FutureReservationStatus"
    }
    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)
    }
  }
#endif
