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

/// A contact that will receive notifications from Google Cloud.
public struct Contact: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Output only. The identifier for the contact.
  /// Format: {resource_type}/{resource_id}/contacts/{contact_id}
  public var name: Swift.String = Swift.String()

  /// Required. The email address to send notifications to. The email address
  /// does not need to be a Google Account.
  public var email: Swift.String = Swift.String()

  /// Required. The categories of notifications that the contact will receive
  /// communications for.
  public var notificationCategorySubscriptions: [NotificationCategory] = []

  /// Required. The preferred language for notifications, as a ISO 639-1 language
  /// code. See [Supported
  /// languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
  /// for a list of supported languages.
  public var languageTag: Swift.String = Swift.String()

  /// Output only. The validity of the contact. A contact is considered valid if
  /// it is the correct recipient for notifications for a particular resource.
  public var validationState: ValidationState = ValidationState()

  /// The last time the validation_state was updated, either manually or
  /// automatically. A contact is considered stale if its validation state was
  /// updated more than 1 year ago.
  public var validateTime: GoogleCloudWkt.Timestamp? = nil

  /// Initialize a new instance of `Contact`.
  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 = Contact().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.essentialcontacts.v1.Contact"
  }
  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)
  }
}
