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

/// Represents a data asset resource that can be packaged and shared via a data
/// product.
public struct DataAsset: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Identifier. Resource name of the data asset.
  /// Format:
  /// projects/{project_id_or_number}/locations/{location_id}/dataProducts/{data_product_id}/dataAssets/{data_asset_id}
  public var name: Swift.String = Swift.String()

  /// Output only. System generated globally unique ID for the data asset.
  /// This ID will be different if the data asset is deleted and re-created
  /// with the same name.
  public var uid: Swift.String = Swift.String()

  /// Output only. The time at which the data asset was created.
  public var createTime: GoogleCloudWkt.Timestamp? = nil

  /// Output only. The time at which the data asset was last updated.
  public var updateTime: GoogleCloudWkt.Timestamp? = nil

  /// Optional. This checksum is computed by the server based on the value of
  /// other fields, and may be sent on update and delete requests to ensure the
  /// client has an up-to-date value before proceeding.
  public var etag: Swift.String = Swift.String()

  /// Optional. User-defined labels for the data asset.
  ///
  /// Example:
  ///  ```
  ///  {
  ///    "environment": "production",
  ///    "billing": "marketing-department"
  ///  }
  ///  ```
  public var labels: [Swift.String: Swift.String] = [:]

  /// Required. Immutable. Full resource name of the cloud resource represented
  /// by the data asset. This must follow
  /// https://cloud.google.com/iam/docs/full-resource-names. Example:
  /// `//bigquery.googleapis.com/projects/my_project_123/datasets/dataset_456/tables/table_789`
  /// Only BigQuery tables and datasets are currently supported.
  /// Data asset creator must have getIamPolicy and setIamPolicy permissions on
  /// the resource. Data asset creator must also have resource specific get
  /// permission, for instance, bigquery.tables.get for BigQuery tables.
  public var resource: Swift.String = Swift.String()

  /// Optional. Access groups configurations for this data asset.
  ///
  /// The key is `DataProduct.AccessGroup.id` and the value is
  /// `AccessGroupConfig`.
  ///
  /// Example:
  /// ```
  ///  {
  ///    "analyst": {
  ///      "iamRoles": ["roles/bigquery.dataViewer"]
  ///    }
  ///  }
  /// ```
  ///
  /// Currently, at most one IAM role is allowed per access group. For providing
  /// multiple predefined IAM roles, wrap them in a custom IAM role as per
  /// https://cloud.google.com/iam/docs/creating-custom-roles.
  public var accessGroupConfigs: [Swift.String: DataAsset.AccessGroupConfig] = [:]

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

  /// Configuration for access group inherited from the parent data product.
  public struct AccessGroupConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Optional. IAM roles granted on the resource to this access group. Role
    /// name follows https://cloud.google.com/iam/docs/reference/rest/v1/roles.
    ///
    /// Example: `[ "roles/bigquery.dataViewer" ]`
    public var iamRoles: [Swift.String] = []

    /// Initialize a new instance of `AccessGroupConfig`.
    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 = AccessGroupConfig().with { $0.iamRoles = ... }
    /// ```
    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.DataAsset.AccessGroupConfig"
    }
    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.DataAsset"
  }
  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)
  }
}
