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

/// Denotes one policy tag in a taxonomy, for example, SSN.
///
/// Policy tags can be defined in a hierarchy. For example:
///
/// ```
/// + Geolocation
///   + LatLong
///   + City
///   + ZipCode
/// ```
///
/// Where the "Geolocation" policy tag contains three children.
public struct PolicyTag: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Identifier. Resource name of this policy tag in the URL format.
  ///
  /// The policy tag manager generates unique taxonomy IDs and policy tag IDs.
  public var name: Swift.String = Swift.String()

  /// Required. User-defined name of this policy tag.
  ///
  /// The name can't start or end with spaces and must be unique within the
  /// parent taxonomy, contain only Unicode letters, numbers, underscores, dashes
  /// and spaces, and be at most 200 bytes long when encoded in UTF-8.
  public var displayName: Swift.String = Swift.String()

  /// Description of this policy tag. If not set, defaults to empty.
  ///
  /// The description must contain only Unicode characters,
  /// tabs, newlines, carriage returns and page breaks, and be at most 2000 bytes
  /// long when encoded in UTF-8.
  public var description: Swift.String = Swift.String()

  /// Resource name of this policy tag's parent policy tag. If empty, this is a
  /// top level tag. If not set, defaults to an empty string.
  ///
  /// For example, for the "LatLong" policy tag in the example above, this field
  /// contains the resource name of the "Geolocation" policy tag, and, for
  /// "Geolocation", this field is empty.
  public var parentPolicyTag: Swift.String = Swift.String()

  /// Output only. Resource names of child policy tags of this policy tag.
  public var childPolicyTags: [Swift.String] = []

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