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

/// DataQualityScan related setting.
public struct DataQualitySpec: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Required. The list of rules to evaluate against a data source. At least one
  /// rule is required.
  public var rules: [DataQualityRule] = []

  /// Optional. The percentage of the records to be selected from the dataset for
  /// DataScan.
  ///
  /// * Value can range between 0.0 and 100.0 with up to 3 significant decimal
  /// digits.
  /// * Sampling is not applied if `sampling_percent` is not specified, 0 or
  /// 100.
  public var samplingPercent: Swift.Float = Swift.Float()

  /// Optional. A filter applied to all rows in a single DataScan job.
  /// The filter needs to be a valid SQL expression for a [WHERE clause in
  /// GoogleSQL
  /// syntax](https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#where_clause).
  ///
  /// Example: col1 >= 0 AND col2 < 10
  public var rowFilter: Swift.String = Swift.String()

  /// Optional. Actions to take upon job completion.
  public var postScanActions: DataQualitySpec.PostScanActions? = nil

  /// Optional. If set, the latest DataScan job result will be published as
  /// Dataplex Universal Catalog metadata.
  public var catalogPublishingEnabled: Swift.Bool = Swift.Bool()

  /// Optional. If enabled, the data scan will retrieve rules defined in the
  /// dataplex-types.global.data-rules aspect on all paths of the catalog entry
  /// corresponding to the BigQuery table resource and all attached glossary
  /// terms. The path that data-rules aspect is attached on the table entry
  /// defines the column that the rule will be evaluated against. For glossary
  /// terms, the path that the terms are attached on the table entry defines the
  /// column that the rule will be evaluated against. At the start of scan
  /// execution, the rules reflect the latest state retrieved from the catalog
  /// entry and any updates on the rules thereafter are ignored for that
  /// execution. The updates will be reflected from the next execution. Rules
  /// defined in the datascan must be empty if this field is enabled.
  public var enableCatalogBasedRules: Swift.Bool = Swift.Bool()

  /// Optional. Filter for selectively running a subset of rules. You can filter
  /// the request by the name or attribute key-value pairs defined on the rule.
  /// If not specified, all rules are run. The filter is applicable to both, the
  /// rules retrieved from catalog and explicitly defined rules in the scan.
  /// Please see [filter
  /// syntax](https://docs.cloud.google.com/dataplex/docs/auto-data-quality-overview#rule-filtering)
  /// for more details.
  public var filter: Swift.String = Swift.String()

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

  /// The configuration of post scan actions of DataQualityScan.
  public struct PostScanActions: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Optional. If set, results will be exported to the provided BigQuery
    /// table.
    public var bigqueryExport: DataQualitySpec.PostScanActions.BigQueryExport? = nil

    /// Optional. If set, results will be sent to the provided notification
    /// receipts upon triggers.
    public var notificationReport: DataQualitySpec.PostScanActions.NotificationReport? = nil

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

    /// The configuration of BigQuery export post scan action.
    public struct BigQueryExport: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Optional. The BigQuery table to export DataQualityScan results to.
      /// Format:
      /// //bigquery.googleapis.com/projects/PROJECT_ID/datasets/DATASET_ID/tables/TABLE_ID
      /// or
      /// projects/PROJECT_ID/datasets/DATASET_ID/tables/TABLE_ID
      public var resultsTable: Swift.String = Swift.String()

      /// Initialize a new instance of `BigQueryExport`.
      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 = BigQueryExport().with { $0.resultsTable = ... }
      /// ```
      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.DataQualitySpec.PostScanActions.BigQueryExport"
      }
      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 individuals or groups who are designated to receive notifications
    /// upon triggers.
    public struct Recipients: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Optional. The email recipients who will receive the DataQualityScan
      /// results report.
      public var emails: [Swift.String] = []

      /// Initialize a new instance of `Recipients`.
      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 = Recipients().with { $0.emails = ... }
      /// ```
      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.DataQualitySpec.PostScanActions.Recipients"
      }
      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)
      }
    }

    /// This trigger is triggered when the DQ score in the job result is less
    /// than a specified input score.
    public struct ScoreThresholdTrigger: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Optional. The score range is in [0,100].
      public var scoreThreshold: Swift.Float = Swift.Float()

      /// Initialize a new instance of `ScoreThresholdTrigger`.
      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 = ScoreThresholdTrigger().with { $0.scoreThreshold = ... }
      /// ```
      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.DataQualitySpec.PostScanActions.ScoreThresholdTrigger"
      }
      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)
      }
    }

    /// This trigger is triggered when the scan job itself fails, regardless of
    /// the result.
    public struct JobFailureTrigger: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Initialize a new instance of `JobFailureTrigger`.
      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 = JobFailureTrigger().with { $0.<placeholder> = ... }
      /// ```
      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.DataQualitySpec.PostScanActions.JobFailureTrigger"
      }
      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)
      }
    }

    /// This trigger is triggered whenever a scan job run ends, regardless
    /// of the result.
    public struct JobEndTrigger: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Initialize a new instance of `JobEndTrigger`.
      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 = JobEndTrigger().with { $0.<placeholder> = ... }
      /// ```
      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.DataQualitySpec.PostScanActions.JobEndTrigger"
      }
      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 configuration of notification report post scan action.
    public struct NotificationReport: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Required. The recipients who will receive the notification report.
      public var recipients: DataQualitySpec.PostScanActions.Recipients? = nil

      /// Optional. If set, report will be sent when score threshold is met.
      public var scoreThresholdTrigger: DataQualitySpec.PostScanActions.ScoreThresholdTrigger? = nil

      /// Optional. If set, report will be sent when a scan job fails.
      public var jobFailureTrigger: DataQualitySpec.PostScanActions.JobFailureTrigger? = nil

      /// Optional. If set, report will be sent when a scan job ends.
      public var jobEndTrigger: DataQualitySpec.PostScanActions.JobEndTrigger? = nil

      /// Initialize a new instance of `NotificationReport`.
      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 = NotificationReport().with { $0.recipients = ... }
      /// ```
      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.DataQualitySpec.PostScanActions.NotificationReport"
      }
      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.DataQualitySpec.PostScanActions"
    }
    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.DataQualitySpec"
  }
  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)
  }
}
