// 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 SqlInstancesService
  import Foundation
  import GoogleCloudWkt

  /// The context to perform a point-in-time recovery of an instance managed by
  /// Backup and Disaster Recovery (DR) Service.
  public struct PointInTimeRestoreContext: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The Backup and Disaster Recovery (DR) Service Datasource URI.
    /// Format:
    /// projects/{project}/locations/{region}/backupVaults/{backupvault}/dataSources/{datasource}.
    public var datasource: Swift.String? = nil

    /// Required. The date and time to which you want to restore the instance.
    public var pointInTime: GoogleCloudWkt.Timestamp? = nil

    /// Target instance name.
    public var targetInstance: Swift.String? = nil

    /// Optional. The resource link for the VPC network from which the Cloud SQL
    /// instance is accessible for private IP. For example,
    /// `/projects/myProject/global/networks/default`.
    public var privateNetwork: Swift.String? = nil

    /// Optional. The name of the allocated IP range for the internal IP Cloud SQL
    /// instance. For example: "google-managed-services-default". If you set this,
    /// then Cloud SQL creates the IP address for the cloned instance in the
    /// allocated range. This range must comply with [RFC
    /// 1035](https://tools.ietf.org/html/rfc1035) standards. Specifically, the
    /// name must be 1-63 characters long and match the regular expression
    /// [a-z]([-a-z0-9]*[a-z0-9])?. Reserved for future use.
    public var allocatedIpRange: Swift.String? = nil

    /// Optional. Point-in-time recovery of an instance to the specified zone. If
    /// no zone is specified, then clone to the same primary zone as the source
    /// instance.
    public var preferredZone: Swift.String? = nil

    /// Optional. Point-in-time recovery of a regional instance in the specified
    /// zones. If not specified, clone to the same secondary zone as the source
    /// instance. This value cannot be the same as the preferred_zone field.
    public var preferredSecondaryZone: Swift.String? = nil

    /// Optional. Specifies the instance settings that will be overridden from the
    /// source instance. This field is only applicable for cross project PITRs.
    public var targetInstanceSettings: DatabaseInstance? = nil

    /// Optional. Specifies the instance settings that will be cleared from the
    /// source instance. This field is only applicable for cross project PITRs.
    public var targetInstanceClearSettingsFieldNames: [Swift.String] = []

    /// Optional. The region of the target instance where the datasource will be
    /// restored. For example: "us-central1".
    public var region: Swift.String? = nil

    /// Initialize a new instance of `PointInTimeRestoreContext`.
    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 = PointInTimeRestoreContext().with { $0.datasource = ... }
    /// ```
    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.sql.v1.PointInTimeRestoreContext"
    }
    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
