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

/// An SSL certificate that a user has been authorized to administer. A user
/// is authorized to administer any certificate that applies to one of their
/// authorized domains.
public struct AuthorizedCertificate: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Full path to the `AuthorizedCertificate` resource in the API. Example:
  /// `apps/myapp/authorizedCertificates/12345`.
  ///
  /// @OutputOnly
  public var name: Swift.String = Swift.String()

  /// Relative name of the certificate. This is a unique value autogenerated
  /// on `AuthorizedCertificate` resource creation. Example: `12345`.
  ///
  /// @OutputOnly
  public var id: Swift.String = Swift.String()

  /// The user-specified display name of the certificate. This is not
  /// guaranteed to be unique. Example: `My Certificate`.
  public var displayName: Swift.String = Swift.String()

  /// Topmost applicable domains of this certificate. This certificate
  /// applies to these domains and their subdomains. Example: `example.com`.
  ///
  /// @OutputOnly
  public var domainNames: [Swift.String] = []

  /// The time when this certificate expires. To update the renewal time on this
  /// certificate, upload an SSL certificate with a different expiration time
  /// using [`AuthorizedCertificates.UpdateAuthorizedCertificate`]().
  ///
  /// @OutputOnly
  public var expireTime: GoogleCloudWkt.Timestamp? = nil

  /// The SSL certificate serving the `AuthorizedCertificate` resource. This
  /// must be obtained independently from a certificate authority.
  public var certificateRawData: CertificateRawData? = nil

  /// Only applicable if this certificate is managed by App Engine. Managed
  /// certificates are tied to the lifecycle of a `DomainMapping` and cannot be
  /// updated or deleted via the `AuthorizedCertificates` API. If this
  /// certificate is manually administered by the user, this field will be empty.
  ///
  /// @OutputOnly
  public var managedCertificate: ManagedCertificate? = nil

  /// The full paths to user visible Domain Mapping resources that have this
  /// certificate mapped. Example: `apps/myapp/domainMappings/example.com`.
  ///
  /// This may not represent the full list of mapped domain mappings if the user
  /// does not have `VIEWER` permissions on all of the applications that have
  /// this certificate mapped. See `domain_mappings_count` for a complete count.
  ///
  /// Only returned by `GET` or `LIST` requests when specifically requested by
  /// the `view=FULL_CERTIFICATE` option.
  ///
  /// @OutputOnly
  public var visibleDomainMappings: [Swift.String] = []

  /// Aggregate count of the domain mappings with this certificate mapped. This
  /// count includes domain mappings on applications for which the user does not
  /// have `VIEWER` permissions.
  ///
  /// Only returned by `GET` or `LIST` requests when specifically requested by
  /// the `view=FULL_CERTIFICATE` option.
  ///
  /// @OutputOnly
  public var domainMappingsCount: Swift.Int32 = Swift.Int32()

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