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

/// These messages contain information about the execution of a datascan.
/// The monitored resource is 'DataScan'
public struct DataScanEvent: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// The data source of the data scan
  public var dataSource: Swift.String = Swift.String()

  /// The identifier of the specific data scan job this log entry is for.
  public var jobId: Swift.String = Swift.String()

  /// The time when the data scan job was created.
  public var createTime: GoogleCloudWkt.Timestamp? = nil

  /// The time when the data scan job started to run.
  public var startTime: GoogleCloudWkt.Timestamp? = nil

  /// The time when the data scan job finished.
  public var endTime: GoogleCloudWkt.Timestamp? = nil

  /// The type of the data scan.
  public var type: DataScanEvent.ScanType = DataScanEvent.ScanType()

  /// The status of the data scan job.
  public var state: DataScanEvent.State = DataScanEvent.State()

  /// The message describing the data scan job event.
  public var message: Swift.String = Swift.String()

  /// A version identifier of the spec which was used to execute this job.
  public var specVersion: Swift.String = Swift.String()

  /// The trigger type of the data scan job.
  public var trigger: DataScanEvent.Trigger = DataScanEvent.Trigger()

  /// The scope of the data scan (e.g. full, incremental).
  public var scope: DataScanEvent.Scope = DataScanEvent.Scope()

  /// The result of post scan actions.
  public var postScanActionsResult: DataScanEvent.PostScanActionsResult? = nil

  /// The status of publishing the data scan as Dataplex Universal Catalog
  /// metadata.
  public var catalogPublishingStatus: DataScanCatalogPublishingStatus? = nil

  /// The result of the data scan job.
  public var result: OneOf_Result? = nil

  /// The applied configs in the data scan job.
  public var appliedConfigs: OneOf_AppliedConfigs? = nil

  /// Initialize a new instance of `DataScanEvent`.
  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 = DataScanEvent().with { $0.dataSource = ... }
  /// ```
  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 dataSource = "dataSource"
    case jobId = "jobId"
    case createTime = "createTime"
    case startTime = "startTime"
    case endTime = "endTime"
    case type = "type"
    case state = "state"
    case message = "message"
    case specVersion = "specVersion"
    case trigger = "trigger"
    case scope = "scope"
    case dataProfile = "dataProfile"
    case dataQuality = "dataQuality"
    case dataProfileConfigs = "dataProfileConfigs"
    case dataQualityConfigs = "dataQualityConfigs"
    case postScanActionsResult = "postScanActionsResult"
    case catalogPublishingStatus = "catalogPublishingStatus"
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
    self.dataSource = try container.decode(Swift.String.self, forKey: .dataSource)
    self.jobId = try container.decode(Swift.String.self, forKey: .jobId)
    self.createTime = try container.decodeIfPresent(
      GoogleCloudWkt.Timestamp.self, forKey: .createTime)
    self.startTime = try container.decodeIfPresent(
      GoogleCloudWkt.Timestamp.self, forKey: .startTime)
    self.endTime = try container.decodeIfPresent(GoogleCloudWkt.Timestamp.self, forKey: .endTime)
    self.type = try container.decode(DataScanEvent.ScanType.self, forKey: .type)
    self.state = try container.decode(DataScanEvent.State.self, forKey: .state)
    self.message = try container.decode(Swift.String.self, forKey: .message)
    self.specVersion = try container.decode(Swift.String.self, forKey: .specVersion)
    self.trigger = try container.decode(DataScanEvent.Trigger.self, forKey: .trigger)
    self.scope = try container.decode(DataScanEvent.Scope.self, forKey: .scope)
    self.postScanActionsResult = try container.decodeIfPresent(
      DataScanEvent.PostScanActionsResult.self, forKey: .postScanActionsResult)
    self.catalogPublishingStatus = try container.decodeIfPresent(
      DataScanCatalogPublishingStatus.self, forKey: .catalogPublishingStatus)

    var result: OneOf_Result? = nil
    let resultCheckAndSet = {
      if result != nil {
        throw DecodingError.dataCorrupted(
          DecodingError.Context(
            codingPath: decoder.codingPath,
            debugDescription: "Multiple values set for oneof 'result'"))
      }
      result = $0
    }
    if let dataProfile = try container.decodeIfPresent(
      DataScanEvent.DataProfileResult?.self, forKey: .dataProfile)
    {
      try resultCheckAndSet(.dataProfile(dataProfile))
    }
    if let dataQuality = try container.decodeIfPresent(
      DataScanEvent.DataQualityResult?.self, forKey: .dataQuality)
    {
      try resultCheckAndSet(.dataQuality(dataQuality))
    }
    self.result = result

    var appliedConfigs: OneOf_AppliedConfigs? = nil
    let appliedConfigsCheckAndSet = {
      if appliedConfigs != nil {
        throw DecodingError.dataCorrupted(
          DecodingError.Context(
            codingPath: decoder.codingPath,
            debugDescription: "Multiple values set for oneof 'appliedConfigs'"))
      }
      appliedConfigs = $0
    }
    if let dataProfileConfigs = try container.decodeIfPresent(
      DataScanEvent.DataProfileAppliedConfigs?.self, forKey: .dataProfileConfigs)
    {
      try appliedConfigsCheckAndSet(.dataProfileConfigs(dataProfileConfigs))
    }
    if let dataQualityConfigs = try container.decodeIfPresent(
      DataScanEvent.DataQualityAppliedConfigs?.self, forKey: .dataQualityConfigs)
    {
      try appliedConfigsCheckAndSet(.dataQualityConfigs(dataQualityConfigs))
    }
    self.appliedConfigs = appliedConfigs
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.dataSource, forKey: .dataSource)
    try container.encode(self.jobId, forKey: .jobId)
    try container.encode(self.createTime, forKey: .createTime)
    try container.encode(self.startTime, forKey: .startTime)
    try container.encode(self.endTime, forKey: .endTime)
    try container.encode(self.type, forKey: .type)
    try container.encode(self.state, forKey: .state)
    try container.encode(self.message, forKey: .message)
    try container.encode(self.specVersion, forKey: .specVersion)
    try container.encode(self.trigger, forKey: .trigger)
    try container.encode(self.scope, forKey: .scope)
    try container.encode(self.postScanActionsResult, forKey: .postScanActionsResult)
    try container.encode(self.catalogPublishingStatus, forKey: .catalogPublishingStatus)

    if let choice = self.result {
      switch choice {
      case .dataProfile(let value):
        try container.encode(value, forKey: .dataProfile)
      case .dataQuality(let value):
        try container.encode(value, forKey: .dataQuality)
      }
    }

    if let choice = self.appliedConfigs {
      switch choice {
      case .dataProfileConfigs(let value):
        try container.encode(value, forKey: .dataProfileConfigs)
      case .dataQualityConfigs(let value):
        try container.encode(value, forKey: .dataQualityConfigs)
      }
    }
  }

  /// Data profile result for data scan job.
  public struct DataProfileResult: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The count of rows processed in the data scan job.
    public var rowCount: Swift.Int64 = Swift.Int64()

    /// Initialize a new instance of `DataProfileResult`.
    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 = DataProfileResult().with { $0.rowCount = ... }
    /// ```
    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.dataplex.v1.DataScanEvent.DataProfileResult"
    }
    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)
    }
  }

  /// Data quality result for data scan job.
  public struct DataQualityResult: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The count of rows processed in the data scan job.
    public var rowCount: Swift.Int64 = Swift.Int64()

    /// Whether the data quality result was `pass` or not.
    public var passed: Swift.Bool = Swift.Bool()

    /// The result of each dimension for data quality result.
    /// The key of the map is the name of the dimension.
    /// The value is the bool value depicting whether the dimension result was
    /// `pass` or not.
    public var dimensionPassed: [Swift.String: Swift.Bool] = [:]

    /// The table-level data quality score for the data scan job.
    ///
    /// The data quality score ranges between [0, 100] (up to two decimal
    /// points).
    public var score: Swift.Float = Swift.Float()

    /// The score of each dimension for data quality result.
    /// The key of the map is the name of the dimension.
    /// The value is the data quality score for the dimension.
    ///
    /// The score ranges between [0, 100] (up to two decimal
    /// points).
    public var dimensionScore: [Swift.String: Swift.Float] = [:]

    /// The score of each column scanned in the data scan job.
    /// The key of the map is the name of the column.
    /// The value is the data quality score for the column.
    ///
    /// The score ranges between [0, 100] (up to two decimal
    /// points).
    public var columnScore: [Swift.String: Swift.Float] = [:]

    /// Initialize a new instance of `DataQualityResult`.
    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 = DataQualityResult().with { $0.rowCount = ... }
    /// ```
    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.dataplex.v1.DataScanEvent.DataQualityResult"
    }
    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)
    }
  }

  /// Applied configs for data profile type data scan job.
  public struct DataProfileAppliedConfigs: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The percentage of the records selected from the dataset for DataScan.
    ///
    /// * Value ranges between 0.0 and 100.0.
    /// * Value 0.0 or 100.0 imply that sampling was not applied.
    public var samplingPercent: Swift.Float = Swift.Float()

    /// Boolean indicating whether a row filter was applied in the DataScan job.
    public var rowFilterApplied: Swift.Bool = Swift.Bool()

    /// Boolean indicating whether a column filter was applied in the DataScan
    /// job.
    public var columnFilterApplied: Swift.Bool = Swift.Bool()

    /// Initialize a new instance of `DataProfileAppliedConfigs`.
    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 = DataProfileAppliedConfigs().with { $0.samplingPercent = ... }
    /// ```
    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.dataplex.v1.DataScanEvent.DataProfileAppliedConfigs"
    }
    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)
    }
  }

  /// Applied configs for data quality type data scan job.
  public struct DataQualityAppliedConfigs: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The percentage of the records selected from the dataset for DataScan.
    ///
    /// * Value ranges between 0.0 and 100.0.
    /// * Value 0.0 or 100.0 imply that sampling was not applied.
    public var samplingPercent: Swift.Float = Swift.Float()

    /// Boolean indicating whether a row filter was applied in the DataScan job.
    public var rowFilterApplied: Swift.Bool = Swift.Bool()

    /// Initialize a new instance of `DataQualityAppliedConfigs`.
    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 = DataQualityAppliedConfigs().with { $0.samplingPercent = ... }
    /// ```
    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.dataplex.v1.DataScanEvent.DataQualityAppliedConfigs"
    }
    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)
    }
  }

  /// Post scan actions result for data scan job.
  public struct PostScanActionsResult: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The result of BigQuery export post scan action.
    public var bigqueryExportResult: DataScanEvent.PostScanActionsResult.BigQueryExportResult? = nil

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

    /// The result of BigQuery export post scan action.
    public struct BigQueryExportResult: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Execution state for the BigQuery exporting.
      public var state: DataScanEvent.PostScanActionsResult.BigQueryExportResult.State =
        DataScanEvent.PostScanActionsResult.BigQueryExportResult.State()

      /// Additional information about the BigQuery exporting.
      public var message: Swift.String = Swift.String()

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

      /// Execution state for the exporting.
      public enum State: Codable, Equatable, Sendable {
        /// The exporting state is unspecified.
        case unspecified
        /// The exporting completed successfully.
        case succeeded
        /// The exporting is no longer running due to an error.
        case failed
        /// The exporting is skipped due to no valid scan result to export
        /// (usually caused by scan failed).
        case skipped
        /// 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 = .unspecified
        }

        /// 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 .unspecified: return 0
          case .succeeded: return 1
          case .failed: return 2
          case .skipped: 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 .unspecified: return "STATE_UNSPECIFIED"
          case .succeeded: return "SUCCEEDED"
          case .failed: return "FAILED"
          case .skipped: return "SKIPPED"
          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:State/unknownStringValue(_:)).
        public init(stringValue: Swift.String) {
          switch stringValue {
          case "STATE_UNSPECIFIED": self = .unspecified
          case "SUCCEEDED": self = .succeeded
          case "FAILED": self = .failed
          case "SKIPPED": self = .skipped
          default: self = .unknownStringValue(stringValue)
          }
        }

        /// Initialize from an integer value.
        ///
        /// If the value is unknown, this initializes to [`unknownIntValue`](doc:State/unknownIntValue(_:)).
        public init(intValue: Int) {
          switch intValue {
          case 0: self = .unspecified
          case 1: self = .succeeded
          case 2: self = .failed
          case 3: self = .skipped
          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 .unspecified: return try container.encode(0)
          case .succeeded: return try container.encode(1)
          case .failed: return try container.encode(2)
          case .skipped: return try container.encode(3)
          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.dataplex.v1.DataScanEvent.PostScanActionsResult.BigQueryExportResult"
      }
      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.dataplex.v1.DataScanEvent.PostScanActionsResult"
    }
    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)
    }
  }

  /// The type of the data scan.
  public enum ScanType: Codable, Equatable, Sendable {
    /// An unspecified data scan type.
    case unspecified
    /// Data scan for data profile.
    case dataProfile
    /// Data scan for data quality.
    case dataQuality
    /// Data scan for data discovery.
    case dataDiscovery
    /// 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 = .unspecified
    }

    /// 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 .unspecified: return 0
      case .dataProfile: return 1
      case .dataQuality: return 2
      case .dataDiscovery: return 4
      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 .unspecified: return "SCAN_TYPE_UNSPECIFIED"
      case .dataProfile: return "DATA_PROFILE"
      case .dataQuality: return "DATA_QUALITY"
      case .dataDiscovery: return "DATA_DISCOVERY"
      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:ScanType/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "SCAN_TYPE_UNSPECIFIED": self = .unspecified
      case "DATA_PROFILE": self = .dataProfile
      case "DATA_QUALITY": self = .dataQuality
      case "DATA_DISCOVERY": self = .dataDiscovery
      default: self = .unknownStringValue(stringValue)
      }
    }

    /// Initialize from an integer value.
    ///
    /// If the value is unknown, this initializes to [`unknownIntValue`](doc:ScanType/unknownIntValue(_:)).
    public init(intValue: Int) {
      switch intValue {
      case 0: self = .unspecified
      case 1: self = .dataProfile
      case 2: self = .dataQuality
      case 4: self = .dataDiscovery
      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 .unspecified: return try container.encode(0)
      case .dataProfile: return try container.encode(1)
      case .dataQuality: return try container.encode(2)
      case .dataDiscovery: return try container.encode(4)
      case .unknownIntValue(let v): return try container.encode(v)
      case .unknownStringValue(let v): return try container.encode(v)
      }
    }
  }

  /// The job state of the data scan.
  public enum State: Codable, Equatable, Sendable {
    /// Unspecified job state.
    case unspecified
    /// Data scan job started.
    case started
    /// Data scan job successfully completed.
    case succeeded
    /// Data scan job was unsuccessful.
    case failed
    /// Data scan job was cancelled.
    case cancelled
    /// Data scan job was created.
    case created
    /// 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 = .unspecified
    }

    /// 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 .unspecified: return 0
      case .started: return 1
      case .succeeded: return 2
      case .failed: return 3
      case .cancelled: return 4
      case .created: return 5
      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 .unspecified: return "STATE_UNSPECIFIED"
      case .started: return "STARTED"
      case .succeeded: return "SUCCEEDED"
      case .failed: return "FAILED"
      case .cancelled: return "CANCELLED"
      case .created: return "CREATED"
      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:State/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "STATE_UNSPECIFIED": self = .unspecified
      case "STARTED": self = .started
      case "SUCCEEDED": self = .succeeded
      case "FAILED": self = .failed
      case "CANCELLED": self = .cancelled
      case "CREATED": self = .created
      default: self = .unknownStringValue(stringValue)
      }
    }

    /// Initialize from an integer value.
    ///
    /// If the value is unknown, this initializes to [`unknownIntValue`](doc:State/unknownIntValue(_:)).
    public init(intValue: Int) {
      switch intValue {
      case 0: self = .unspecified
      case 1: self = .started
      case 2: self = .succeeded
      case 3: self = .failed
      case 4: self = .cancelled
      case 5: self = .created
      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 .unspecified: return try container.encode(0)
      case .started: return try container.encode(1)
      case .succeeded: return try container.encode(2)
      case .failed: return try container.encode(3)
      case .cancelled: return try container.encode(4)
      case .created: return try container.encode(5)
      case .unknownIntValue(let v): return try container.encode(v)
      case .unknownStringValue(let v): return try container.encode(v)
      }
    }
  }

  /// The trigger type for the data scan.
  public enum Trigger: Codable, Equatable, Sendable {
    /// An unspecified trigger type.
    case unspecified
    /// Data scan triggers on demand.
    case onDemand
    /// Data scan triggers as per schedule.
    case schedule
    /// Data scan is run one time on creation.
    case oneTime
    /// 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 = .unspecified
    }

    /// 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 .unspecified: return 0
      case .onDemand: return 1
      case .schedule: return 2
      case .oneTime: 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 .unspecified: return "TRIGGER_UNSPECIFIED"
      case .onDemand: return "ON_DEMAND"
      case .schedule: return "SCHEDULE"
      case .oneTime: return "ONE_TIME"
      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:Trigger/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "TRIGGER_UNSPECIFIED": self = .unspecified
      case "ON_DEMAND": self = .onDemand
      case "SCHEDULE": self = .schedule
      case "ONE_TIME": self = .oneTime
      default: self = .unknownStringValue(stringValue)
      }
    }

    /// Initialize from an integer value.
    ///
    /// If the value is unknown, this initializes to [`unknownIntValue`](doc:Trigger/unknownIntValue(_:)).
    public init(intValue: Int) {
      switch intValue {
      case 0: self = .unspecified
      case 1: self = .onDemand
      case 2: self = .schedule
      case 3: self = .oneTime
      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 .unspecified: return try container.encode(0)
      case .onDemand: return try container.encode(1)
      case .schedule: return try container.encode(2)
      case .oneTime: return try container.encode(3)
      case .unknownIntValue(let v): return try container.encode(v)
      case .unknownStringValue(let v): return try container.encode(v)
      }
    }
  }

  /// The scope of job for the data scan.
  public enum Scope: Codable, Equatable, Sendable {
    /// An unspecified scope type.
    case unspecified
    /// Data scan runs on all of the data.
    case full
    /// Data scan runs on incremental data.
    case incremental
    /// 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 = .unspecified
    }

    /// 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 .unspecified: return 0
      case .full: return 1
      case .incremental: return 2
      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 .unspecified: return "SCOPE_UNSPECIFIED"
      case .full: return "FULL"
      case .incremental: return "INCREMENTAL"
      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:Scope/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "SCOPE_UNSPECIFIED": self = .unspecified
      case "FULL": self = .full
      case "INCREMENTAL": self = .incremental
      default: self = .unknownStringValue(stringValue)
      }
    }

    /// Initialize from an integer value.
    ///
    /// If the value is unknown, this initializes to [`unknownIntValue`](doc:Scope/unknownIntValue(_:)).
    public init(intValue: Int) {
      switch intValue {
      case 0: self = .unspecified
      case 1: self = .full
      case 2: self = .incremental
      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 .unspecified: return try container.encode(0)
      case .full: return try container.encode(1)
      case .incremental: return try container.encode(2)
      case .unknownIntValue(let v): return try container.encode(v)
      case .unknownStringValue(let v): return try container.encode(v)
      }
    }
  }

  /// The result of the data scan job.
  public enum OneOf_Result: Codable, Equatable, Sendable {
    /// Data profile result for data profile type data scan.
    indirect case dataProfile(DataScanEvent.DataProfileResult?)
    /// Data quality result for data quality type data scan.
    indirect case dataQuality(DataScanEvent.DataQualityResult?)
  }

  /// The applied configs in the data scan job.
  public enum OneOf_AppliedConfigs: Codable, Equatable, Sendable {
    /// Applied configs for data profile type data scan.
    indirect case dataProfileConfigs(DataScanEvent.DataProfileAppliedConfigs?)
    /// Applied configs for data quality type data scan.
    indirect case dataQualityConfigs(DataScanEvent.DataQualityAppliedConfigs?)
  }

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