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

/// `Service` is the root object of Google API service configuration (service
/// config). It describes the basic information about a logical service,
/// such as the service name and the user-facing title, and delegates other
/// aspects to sub-sections. Each sub-section is either a proto message or a
/// repeated proto message that configures a specific aspect, such as auth.
/// For more information, see each proto message definition.
///
/// Example:
///
///     type: google.api.Service
///     name: calendar.googleapis.com
///     title: Google Calendar API
///     apis:
///     - name: google.calendar.v3.Calendar
///
///     visibility:
///       rules:
///       - selector: "google.calendar.v3.*"
///         restriction: PREVIEW
///     backend:
///       rules:
///       - selector: "google.calendar.v3.*"
///         address: calendar.example.com
///
///     authentication:
///       providers:
///       - id: google_calendar_auth
///         jwks_uri: https://www.googleapis.com/oauth2/v1/certs
///         issuer: https://securetoken.google.com
///       rules:
///       - selector: "*"
///         requirements:
///           provider_id: google_calendar_auth
public struct Service: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// The service name, which is a DNS-like logical identifier for the
  /// service, such as `calendar.googleapis.com`. The service name
  /// typically goes through DNS verification to make sure the owner
  /// of the service also owns the DNS name.
  public var name: Swift.String = Swift.String()

  /// The product title for this service, it is the name displayed in Google
  /// Cloud Console.
  public var title: Swift.String = Swift.String()

  /// The Google project that owns this service.
  public var producerProjectId: Swift.String = Swift.String()

  /// A unique ID for a specific instance of this message, typically assigned
  /// by the client for tracking purpose. Must be no longer than 63 characters
  /// and only lower case letters, digits, '.', '_' and '-' are allowed. If
  /// empty, the server may choose to generate one instead.
  public var id: Swift.String = Swift.String()

  /// A list of API interfaces exported by this service. Only the `name` field
  /// of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by
  /// the configuration author, as the remaining fields will be derived from the
  /// IDL during the normalization process. It is an error to specify an API
  /// interface here which cannot be resolved against the associated IDL files.
  ///
  /// [google.protobuf.Api]: https://www.google.com/search?q=Swift+google.protobuf+GoogleCloudWkt.Api
  public var apis: [GoogleCloudWkt.Api] = []

  /// A list of all proto message types included in this API service.
  /// Types referenced directly or indirectly by the `apis` are automatically
  /// included.  Messages which are not referenced but shall be included, such as
  /// types used by the `google.protobuf.Any` type, should be listed here by
  /// name by the configuration author. Example:
  ///
  ///     types:
  ///     - name: google.protobuf.Int32
  public var types: [GoogleCloudWkt.Type_] = []

  /// A list of all enum types included in this API service.  Enums referenced
  /// directly or indirectly by the `apis` are automatically included.  Enums
  /// which are not referenced but shall be included should be listed here by
  /// name by the configuration author. Example:
  ///
  ///     enums:
  ///     - name: google.someapi.v1.SomeEnum
  public var enums: [GoogleCloudWkt.Enum] = []

  /// Additional API documentation.
  public var documentation: Documentation? = nil

  /// API backend configuration.
  public var backend: Backend? = nil

  /// HTTP configuration.
  public var http: Http? = nil

  /// Quota configuration.
  public var quota: Quota? = nil

  /// Auth configuration.
  public var authentication: Authentication? = nil

  /// Context configuration.
  public var context: Context? = nil

  /// Configuration controlling usage of this service.
  public var usage: Usage? = nil

  /// Configuration for network endpoints.  If this is empty, then an endpoint
  /// with the same name as the service is automatically generated to service all
  /// defined APIs.
  public var endpoints: [Endpoint] = []

  /// Configuration for the service control plane.
  public var control: Control? = nil

  /// Defines the logs used by this service.
  public var logs: [LogDescriptor] = []

  /// Defines the metrics used by this service.
  public var metrics: [MetricDescriptor] = []

  /// Defines the monitored resources used by this service. This is required
  /// by the `Service.monitoring` and `Service.logging` configurations.
  public var monitoredResources: [MonitoredResourceDescriptor] = []

  /// Billing configuration.
  public var billing: Billing? = nil

  /// Logging configuration.
  public var logging: Logging? = nil

  /// Monitoring configuration.
  public var monitoring: Monitoring? = nil

  /// System parameter configuration.
  public var systemParameters: SystemParameters? = nil

  /// Output only. The source information for this configuration if available.
  public var sourceInfo: SourceInfo? = nil

  /// Settings for [Google Cloud Client
  /// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
  /// generated from APIs defined as protocol buffers.
  public var publishing: Publishing? = nil

  /// Obsolete. Do not use.
  ///
  /// This field has no semantic meaning. The service config compiler always
  /// sets this field to `3`.
  public var configVersion: GoogleCloudWkt.UInt32Value? = nil

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