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

  /// Config of migrating one resource from automl.googleapis.com,
  /// datalabeling.googleapis.com and ml.googleapis.com to Vertex AI.
  public struct MigrateResourceRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    public var request: OneOf_Request? = nil

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

    private enum CodingKeys: Swift.String, CodingKey {
      case migrateMlEngineModelVersionConfig = "migrateMlEngineModelVersionConfig"
      case migrateAutomlModelConfig = "migrateAutomlModelConfig"
      case migrateAutomlDatasetConfig = "migrateAutomlDatasetConfig"
      case migrateDataLabelingDatasetConfig = "migrateDataLabelingDatasetConfig"
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.container(keyedBy: CodingKeys.self)

      var request: OneOf_Request? = nil
      let requestCheckAndSet = {
        if request != nil {
          throw DecodingError.dataCorrupted(
            DecodingError.Context(
              codingPath: decoder.codingPath,
              debugDescription: "Multiple values set for oneof 'request'"))
        }
        request = $0
      }
      if let migrateMlEngineModelVersionConfig = try container.decodeIfPresent(
        MigrateResourceRequest.MigrateMlEngineModelVersionConfig?.self,
        forKey: .migrateMlEngineModelVersionConfig)
      {
        try requestCheckAndSet(
          .migrateMlEngineModelVersionConfig(migrateMlEngineModelVersionConfig))
      }
      if let migrateAutomlModelConfig = try container.decodeIfPresent(
        MigrateResourceRequest.MigrateAutomlModelConfig?.self, forKey: .migrateAutomlModelConfig)
      {
        try requestCheckAndSet(.migrateAutomlModelConfig(migrateAutomlModelConfig))
      }
      if let migrateAutomlDatasetConfig = try container.decodeIfPresent(
        MigrateResourceRequest.MigrateAutomlDatasetConfig?.self, forKey: .migrateAutomlDatasetConfig
      ) {
        try requestCheckAndSet(.migrateAutomlDatasetConfig(migrateAutomlDatasetConfig))
      }
      if let migrateDataLabelingDatasetConfig = try container.decodeIfPresent(
        MigrateResourceRequest.MigrateDataLabelingDatasetConfig?.self,
        forKey: .migrateDataLabelingDatasetConfig)
      {
        try requestCheckAndSet(.migrateDataLabelingDatasetConfig(migrateDataLabelingDatasetConfig))
      }
      self.request = request
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.container(keyedBy: CodingKeys.self)

      if let choice = self.request {
        switch choice {
        case .migrateMlEngineModelVersionConfig(let value):
          try container.encode(value, forKey: .migrateMlEngineModelVersionConfig)
        case .migrateAutomlModelConfig(let value):
          try container.encode(value, forKey: .migrateAutomlModelConfig)
        case .migrateAutomlDatasetConfig(let value):
          try container.encode(value, forKey: .migrateAutomlDatasetConfig)
        case .migrateDataLabelingDatasetConfig(let value):
          try container.encode(value, forKey: .migrateDataLabelingDatasetConfig)
        }
      }
    }

    /// Config for migrating version in ml.googleapis.com to Vertex AI's Model.
    public struct MigrateMlEngineModelVersionConfig: Codable, Equatable, GoogleCloudWkt
        ._AnyPackable,
      Sendable
    {
      /// Required. The ml.googleapis.com endpoint that this model version should
      /// be migrated from. Example values:
      ///
      /// * ml.googleapis.com
      ///
      /// * us-centrall-ml.googleapis.com
      ///
      /// * europe-west4-ml.googleapis.com
      ///
      /// * asia-east1-ml.googleapis.com
      public var endpoint: Swift.String = Swift.String()

      /// Required. Full resource name of ml engine model version.
      /// Format: `projects/{project}/models/{model}/versions/{version}`.
      public var modelVersion: Swift.String = Swift.String()

      /// Required. Display name of the model in Vertex AI.
      /// System will pick a display name if unspecified.
      public var modelDisplayName: Swift.String = Swift.String()

      /// Initialize a new instance of `MigrateMlEngineModelVersionConfig`.
      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 = MigrateMlEngineModelVersionConfig().with { $0.endpoint = ... }
      /// ```
      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.aiplatform.v1.MigrateResourceRequest.MigrateMlEngineModelVersionConfig"
      }
      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)
      }
    }

    /// Config for migrating Model in automl.googleapis.com to Vertex AI's Model.
    public struct MigrateAutomlModelConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Required. Full resource name of automl Model.
      /// Format:
      /// `projects/{project}/locations/{location}/models/{model}`.
      public var model: Swift.String = Swift.String()

      /// Optional. Display name of the model in Vertex AI.
      /// System will pick a display name if unspecified.
      public var modelDisplayName: Swift.String = Swift.String()

      /// Initialize a new instance of `MigrateAutomlModelConfig`.
      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 = MigrateAutomlModelConfig().with { $0.model = ... }
      /// ```
      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.aiplatform.v1.MigrateResourceRequest.MigrateAutomlModelConfig"
      }
      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)
      }
    }

    /// Config for migrating Dataset in automl.googleapis.com to Vertex AI's
    /// Dataset.
    public struct MigrateAutomlDatasetConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Required. Full resource name of automl Dataset.
      /// Format:
      /// `projects/{project}/locations/{location}/datasets/{dataset}`.
      public var dataset: Swift.String = Swift.String()

      /// Required. Display name of the Dataset in Vertex AI.
      /// System will pick a display name if unspecified.
      public var datasetDisplayName: Swift.String = Swift.String()

      /// Initialize a new instance of `MigrateAutomlDatasetConfig`.
      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 = MigrateAutomlDatasetConfig().with { $0.dataset = ... }
      /// ```
      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.aiplatform.v1.MigrateResourceRequest.MigrateAutomlDatasetConfig"
      }
      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)
      }
    }

    /// Config for migrating Dataset in datalabeling.googleapis.com to Vertex
    /// AI's Dataset.
    public struct MigrateDataLabelingDatasetConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Required. Full resource name of data labeling Dataset.
      /// Format:
      /// `projects/{project}/datasets/{dataset}`.
      public var dataset: Swift.String = Swift.String()

      /// Optional. Display name of the Dataset in Vertex AI.
      /// System will pick a display name if unspecified.
      public var datasetDisplayName: Swift.String = Swift.String()

      /// Optional. Configs for migrating AnnotatedDataset in
      /// datalabeling.googleapis.com to Vertex AI's SavedQuery. The specified
      /// AnnotatedDatasets have to belong to the datalabeling Dataset.
      public var migrateDataLabelingAnnotatedDatasetConfigs:
        [MigrateResourceRequest.MigrateDataLabelingDatasetConfig
          .MigrateDataLabelingAnnotatedDatasetConfig] = []

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

      /// Config for migrating AnnotatedDataset in datalabeling.googleapis.com to
      /// Vertex AI's SavedQuery.
      public struct MigrateDataLabelingAnnotatedDatasetConfig: Codable, Equatable, GoogleCloudWkt
          ._AnyPackable,
        Sendable
      {
        /// Required. Full resource name of data labeling AnnotatedDataset.
        /// Format:
        /// `projects/{project}/datasets/{dataset}/annotatedDatasets/{annotated_dataset}`.
        public var annotatedDataset: Swift.String = Swift.String()

        /// Initialize a new instance of `MigrateDataLabelingAnnotatedDatasetConfig`.
        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 = MigrateDataLabelingAnnotatedDatasetConfig().with { $0.annotatedDataset = ... }
        /// ```
        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.aiplatform.v1.MigrateResourceRequest.MigrateDataLabelingDatasetConfig.MigrateDataLabelingAnnotatedDatasetConfig"
        }
        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.aiplatform.v1.MigrateResourceRequest.MigrateDataLabelingDatasetConfig"
      }
      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 enum OneOf_Request: Codable, Equatable, Sendable {
      /// Config for migrating Version in ml.googleapis.com to Vertex AI's Model.
      indirect case migrateMlEngineModelVersionConfig(
        MigrateResourceRequest.MigrateMlEngineModelVersionConfig?)
      /// Config for migrating Model in automl.googleapis.com to Vertex AI's
      /// Model.
      indirect case migrateAutomlModelConfig(MigrateResourceRequest.MigrateAutomlModelConfig?)
      /// Config for migrating Dataset in automl.googleapis.com to Vertex AI's
      /// Dataset.
      indirect case migrateAutomlDatasetConfig(MigrateResourceRequest.MigrateAutomlDatasetConfig?)
      /// Config for migrating Dataset in datalabeling.googleapis.com to
      /// Vertex AI's Dataset.
      indirect case migrateDataLabelingDatasetConfig(
        MigrateResourceRequest.MigrateDataLabelingDatasetConfig?)
    }

    public static var _anyTypeUrl: Swift.String {
      return "type.googleapis.com/google.cloud.aiplatform.v1.MigrateResourceRequest"
    }
    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
