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

/// Remote repository configuration.
public struct RemoteRepositoryConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// The description of the remote source.
  public var description: Swift.String = Swift.String()

  /// Optional. The credentials used to access the remote repository.
  public var upstreamCredentials: RemoteRepositoryConfig.UpstreamCredentials? = nil

  /// Input only. A create/update remote repo option to avoid making a HEAD/GET
  /// request to validate a remote repo and any supplied upstream credentials.
  public var disableUpstreamValidation: Swift.Bool = Swift.Bool()

  /// Settings specific to the remote repository.
  public var remoteSource: OneOf_RemoteSource? = nil

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

  private enum CodingKeys: Swift.String, CodingKey {
    case dockerRepository = "dockerRepository"
    case mavenRepository = "mavenRepository"
    case npmRepository = "npmRepository"
    case pythonRepository = "pythonRepository"
    case aptRepository = "aptRepository"
    case yumRepository = "yumRepository"
    case commonRepository = "commonRepository"
    case description = "description"
    case upstreamCredentials = "upstreamCredentials"
    case disableUpstreamValidation = "disableUpstreamValidation"
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
    self.description = try container.decode(Swift.String.self, forKey: .description)
    self.upstreamCredentials = try container.decodeIfPresent(
      RemoteRepositoryConfig.UpstreamCredentials.self, forKey: .upstreamCredentials)
    self.disableUpstreamValidation = try container.decode(
      Swift.Bool.self, forKey: .disableUpstreamValidation)

    var remoteSource: OneOf_RemoteSource? = nil
    let remoteSourceCheckAndSet = {
      if remoteSource != nil {
        throw DecodingError.dataCorrupted(
          DecodingError.Context(
            codingPath: decoder.codingPath,
            debugDescription: "Multiple values set for oneof 'remoteSource'"))
      }
      remoteSource = $0
    }
    if let dockerRepository = try container.decodeIfPresent(
      RemoteRepositoryConfig.DockerRepository?.self, forKey: .dockerRepository)
    {
      try remoteSourceCheckAndSet(.dockerRepository(dockerRepository))
    }
    if let mavenRepository = try container.decodeIfPresent(
      RemoteRepositoryConfig.MavenRepository?.self, forKey: .mavenRepository)
    {
      try remoteSourceCheckAndSet(.mavenRepository(mavenRepository))
    }
    if let npmRepository = try container.decodeIfPresent(
      RemoteRepositoryConfig.NpmRepository?.self, forKey: .npmRepository)
    {
      try remoteSourceCheckAndSet(.npmRepository(npmRepository))
    }
    if let pythonRepository = try container.decodeIfPresent(
      RemoteRepositoryConfig.PythonRepository?.self, forKey: .pythonRepository)
    {
      try remoteSourceCheckAndSet(.pythonRepository(pythonRepository))
    }
    if let aptRepository = try container.decodeIfPresent(
      RemoteRepositoryConfig.AptRepository?.self, forKey: .aptRepository)
    {
      try remoteSourceCheckAndSet(.aptRepository(aptRepository))
    }
    if let yumRepository = try container.decodeIfPresent(
      RemoteRepositoryConfig.YumRepository?.self, forKey: .yumRepository)
    {
      try remoteSourceCheckAndSet(.yumRepository(yumRepository))
    }
    if let commonRepository = try container.decodeIfPresent(
      RemoteRepositoryConfig.CommonRemoteRepository?.self, forKey: .commonRepository)
    {
      try remoteSourceCheckAndSet(.commonRepository(commonRepository))
    }
    self.remoteSource = remoteSource
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.description, forKey: .description)
    try container.encode(self.upstreamCredentials, forKey: .upstreamCredentials)
    try container.encode(self.disableUpstreamValidation, forKey: .disableUpstreamValidation)

    if let choice = self.remoteSource {
      switch choice {
      case .dockerRepository(let value):
        try container.encode(value, forKey: .dockerRepository)
      case .mavenRepository(let value):
        try container.encode(value, forKey: .mavenRepository)
      case .npmRepository(let value):
        try container.encode(value, forKey: .npmRepository)
      case .pythonRepository(let value):
        try container.encode(value, forKey: .pythonRepository)
      case .aptRepository(let value):
        try container.encode(value, forKey: .aptRepository)
      case .yumRepository(let value):
        try container.encode(value, forKey: .yumRepository)
      case .commonRepository(let value):
        try container.encode(value, forKey: .commonRepository)
      }
    }
  }

  /// The credentials to access the remote repository.
  public struct UpstreamCredentials: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    public var credentials: OneOf_Credentials? = nil

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

    private enum CodingKeys: Swift.String, CodingKey {
      case usernamePasswordCredentials = "usernamePasswordCredentials"
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.container(keyedBy: CodingKeys.self)

      var credentials: OneOf_Credentials? = nil
      let credentialsCheckAndSet = {
        if credentials != nil {
          throw DecodingError.dataCorrupted(
            DecodingError.Context(
              codingPath: decoder.codingPath,
              debugDescription: "Multiple values set for oneof 'credentials'"))
        }
        credentials = $0
      }
      if let usernamePasswordCredentials = try container.decodeIfPresent(
        RemoteRepositoryConfig.UpstreamCredentials.UsernamePasswordCredentials?.self,
        forKey: .usernamePasswordCredentials)
      {
        try credentialsCheckAndSet(.usernamePasswordCredentials(usernamePasswordCredentials))
      }
      self.credentials = credentials
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.container(keyedBy: CodingKeys.self)

      if let choice = self.credentials {
        switch choice {
        case .usernamePasswordCredentials(let value):
          try container.encode(value, forKey: .usernamePasswordCredentials)
        }
      }
    }

    /// Username and password credentials.
    public struct UsernamePasswordCredentials: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// The username to access the remote repository.
      public var username: Swift.String = Swift.String()

      /// The Secret Manager key version that holds the password to access the
      /// remote repository. Must be in the format of
      /// `projects/{project}/secrets/{secret}/versions/{version}`.
      public var passwordSecretVersion: Swift.String = Swift.String()

      /// Initialize a new instance of `UsernamePasswordCredentials`.
      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 = UsernamePasswordCredentials().with { $0.username = ... }
      /// ```
      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.devtools.artifactregistry.v1.RemoteRepositoryConfig.UpstreamCredentials.UsernamePasswordCredentials"
      }
      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 enum OneOf_Credentials: Codable, Equatable, Sendable {
      /// Use username and password to access the remote repository.
      indirect case usernamePasswordCredentials(
        RemoteRepositoryConfig.UpstreamCredentials.UsernamePasswordCredentials?)
    }

    public static var _anyTypeUrl: Swift.String {
      return
        "type.googleapis.com/google.devtools.artifactregistry.v1.RemoteRepositoryConfig.UpstreamCredentials"
    }
    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)
    }
  }

  /// Configuration for a Docker remote repository.
  public struct DockerRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Address of the remote repository.
    public var upstream: OneOf_Upstream? = nil

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

    private enum CodingKeys: Swift.String, CodingKey {
      case publicRepository = "publicRepository"
      case customRepository = "customRepository"
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.container(keyedBy: CodingKeys.self)

      var upstream: OneOf_Upstream? = nil
      let upstreamCheckAndSet = {
        if upstream != nil {
          throw DecodingError.dataCorrupted(
            DecodingError.Context(
              codingPath: decoder.codingPath,
              debugDescription: "Multiple values set for oneof 'upstream'"))
        }
        upstream = $0
      }
      if let publicRepository = try container.decodeIfPresent(
        RemoteRepositoryConfig.DockerRepository.PublicRepository.self, forKey: .publicRepository)
      {
        try upstreamCheckAndSet(.publicRepository(publicRepository))
      }
      if let customRepository = try container.decodeIfPresent(
        RemoteRepositoryConfig.DockerRepository.CustomRepository?.self, forKey: .customRepository)
      {
        try upstreamCheckAndSet(.customRepository(customRepository))
      }
      self.upstream = upstream
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.container(keyedBy: CodingKeys.self)

      if let choice = self.upstream {
        switch choice {
        case .publicRepository(let value):
          try container.encode(value, forKey: .publicRepository)
        case .customRepository(let value):
          try container.encode(value, forKey: .customRepository)
        }
      }
    }

    /// Customer-specified publicly available remote repository.
    public struct CustomRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// An http/https uri reference to the custom remote repository, for ex:
      /// "https://registry-1.docker.io".
      public var uri: Swift.String = Swift.String()

      /// Initialize a new instance of `CustomRepository`.
      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 = CustomRepository().with { $0.uri = ... }
      /// ```
      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.devtools.artifactregistry.v1.RemoteRepositoryConfig.DockerRepository.CustomRepository"
      }
      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)
      }
    }

    /// Predefined list of publicly available Docker repositories like Docker
    /// Hub.
    public enum PublicRepository: Codable, Equatable, Sendable {
      /// Unspecified repository.
      case unspecified
      /// Docker Hub.
      case dockerHub
      /// Encodes an unknown integer value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownIntValue(Int)
      /// Encodes an unknown string value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownStringValue(String)

      public init() {
        self = .unspecified
      }

      /// Returns the integer value associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown string value, this returns `nil`.
      public var intValue: Int? {
        switch self {
        case .unspecified: return 0
        case .dockerHub: return 1
        case .unknownIntValue(let v): return v
        case .unknownStringValue: return nil
        }
      }

      /// Returns the string value (or name) associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
      public var stringValue: Swift.String? {
        switch self {
        case .unspecified: return "PUBLIC_REPOSITORY_UNSPECIFIED"
        case .dockerHub: return "DOCKER_HUB"
        case .unknownIntValue: return nil
        case .unknownStringValue(let v): return v
        }
      }

      /// Initialize from a string value.
      ///
      /// If the value is unknown, this initializes to [`unknownStringValue`](doc:PublicRepository/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "PUBLIC_REPOSITORY_UNSPECIFIED": self = .unspecified
        case "DOCKER_HUB": self = .dockerHub
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:PublicRepository/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .unspecified
        case 1: self = .dockerHub
        default: self = .unknownIntValue(intValue)
        }
      }

      public init(from decoder: Decoder) throws {
        let container = try decoder.singleValueContainer()
        if let v = try? container.decode(Int.self) {
          self.init(intValue: v)
          return
        }
        if let s = try? container.decode(String.self) {
          if let v = Int(s) {
            self.init(intValue: v)
          } else {
            self.init(stringValue: s)
          }
          return
        }
        throw DecodingError.dataCorruptedError(
          in: container, debugDescription: "Expected enum value, must be integer or string.")
      }

      public func encode(to encoder: Encoder) throws {
        var container = encoder.singleValueContainer()
        switch self {
        case .unspecified: return try container.encode(0)
        case .dockerHub: return try container.encode(1)
        case .unknownIntValue(let v): return try container.encode(v)
        case .unknownStringValue(let v): return try container.encode(v)
        }
      }
    }

    /// Address of the remote repository.
    public enum OneOf_Upstream: Codable, Equatable, Sendable {
      /// One of the publicly available Docker repositories supported by Artifact
      /// Registry.
      case publicRepository(RemoteRepositoryConfig.DockerRepository.PublicRepository)
      /// Customer-specified remote repository.
      indirect case customRepository(RemoteRepositoryConfig.DockerRepository.CustomRepository?)
    }

    public static var _anyTypeUrl: Swift.String {
      return
        "type.googleapis.com/google.devtools.artifactregistry.v1.RemoteRepositoryConfig.DockerRepository"
    }
    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)
    }
  }

  /// Configuration for a Maven remote repository.
  public struct MavenRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Address of the remote repository.
    public var upstream: OneOf_Upstream? = nil

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

    private enum CodingKeys: Swift.String, CodingKey {
      case publicRepository = "publicRepository"
      case customRepository = "customRepository"
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.container(keyedBy: CodingKeys.self)

      var upstream: OneOf_Upstream? = nil
      let upstreamCheckAndSet = {
        if upstream != nil {
          throw DecodingError.dataCorrupted(
            DecodingError.Context(
              codingPath: decoder.codingPath,
              debugDescription: "Multiple values set for oneof 'upstream'"))
        }
        upstream = $0
      }
      if let publicRepository = try container.decodeIfPresent(
        RemoteRepositoryConfig.MavenRepository.PublicRepository.self, forKey: .publicRepository)
      {
        try upstreamCheckAndSet(.publicRepository(publicRepository))
      }
      if let customRepository = try container.decodeIfPresent(
        RemoteRepositoryConfig.MavenRepository.CustomRepository?.self, forKey: .customRepository)
      {
        try upstreamCheckAndSet(.customRepository(customRepository))
      }
      self.upstream = upstream
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.container(keyedBy: CodingKeys.self)

      if let choice = self.upstream {
        switch choice {
        case .publicRepository(let value):
          try container.encode(value, forKey: .publicRepository)
        case .customRepository(let value):
          try container.encode(value, forKey: .customRepository)
        }
      }
    }

    /// Customer-specified publicly available remote repository.
    public struct CustomRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// An http/https uri reference to the upstream remote repository, for ex:
      /// "https://my.maven.registry/".
      public var uri: Swift.String = Swift.String()

      /// Initialize a new instance of `CustomRepository`.
      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 = CustomRepository().with { $0.uri = ... }
      /// ```
      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.devtools.artifactregistry.v1.RemoteRepositoryConfig.MavenRepository.CustomRepository"
      }
      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)
      }
    }

    /// Predefined list of publicly available Maven repositories like Maven
    /// Central.
    public enum PublicRepository: Codable, Equatable, Sendable {
      /// Unspecified repository.
      case unspecified
      /// Maven Central.
      case mavenCentral
      /// Encodes an unknown integer value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownIntValue(Int)
      /// Encodes an unknown string value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownStringValue(String)

      public init() {
        self = .unspecified
      }

      /// Returns the integer value associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown string value, this returns `nil`.
      public var intValue: Int? {
        switch self {
        case .unspecified: return 0
        case .mavenCentral: return 1
        case .unknownIntValue(let v): return v
        case .unknownStringValue: return nil
        }
      }

      /// Returns the string value (or name) associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
      public var stringValue: Swift.String? {
        switch self {
        case .unspecified: return "PUBLIC_REPOSITORY_UNSPECIFIED"
        case .mavenCentral: return "MAVEN_CENTRAL"
        case .unknownIntValue: return nil
        case .unknownStringValue(let v): return v
        }
      }

      /// Initialize from a string value.
      ///
      /// If the value is unknown, this initializes to [`unknownStringValue`](doc:PublicRepository/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "PUBLIC_REPOSITORY_UNSPECIFIED": self = .unspecified
        case "MAVEN_CENTRAL": self = .mavenCentral
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:PublicRepository/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .unspecified
        case 1: self = .mavenCentral
        default: self = .unknownIntValue(intValue)
        }
      }

      public init(from decoder: Decoder) throws {
        let container = try decoder.singleValueContainer()
        if let v = try? container.decode(Int.self) {
          self.init(intValue: v)
          return
        }
        if let s = try? container.decode(String.self) {
          if let v = Int(s) {
            self.init(intValue: v)
          } else {
            self.init(stringValue: s)
          }
          return
        }
        throw DecodingError.dataCorruptedError(
          in: container, debugDescription: "Expected enum value, must be integer or string.")
      }

      public func encode(to encoder: Encoder) throws {
        var container = encoder.singleValueContainer()
        switch self {
        case .unspecified: return try container.encode(0)
        case .mavenCentral: return try container.encode(1)
        case .unknownIntValue(let v): return try container.encode(v)
        case .unknownStringValue(let v): return try container.encode(v)
        }
      }
    }

    /// Address of the remote repository.
    public enum OneOf_Upstream: Codable, Equatable, Sendable {
      /// One of the publicly available Maven repositories supported by Artifact
      /// Registry.
      case publicRepository(RemoteRepositoryConfig.MavenRepository.PublicRepository)
      /// Customer-specified remote repository.
      indirect case customRepository(RemoteRepositoryConfig.MavenRepository.CustomRepository?)
    }

    public static var _anyTypeUrl: Swift.String {
      return
        "type.googleapis.com/google.devtools.artifactregistry.v1.RemoteRepositoryConfig.MavenRepository"
    }
    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)
    }
  }

  /// Configuration for a Npm remote repository.
  public struct NpmRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Address of the remote repository
    public var upstream: OneOf_Upstream? = nil

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

    private enum CodingKeys: Swift.String, CodingKey {
      case publicRepository = "publicRepository"
      case customRepository = "customRepository"
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.container(keyedBy: CodingKeys.self)

      var upstream: OneOf_Upstream? = nil
      let upstreamCheckAndSet = {
        if upstream != nil {
          throw DecodingError.dataCorrupted(
            DecodingError.Context(
              codingPath: decoder.codingPath,
              debugDescription: "Multiple values set for oneof 'upstream'"))
        }
        upstream = $0
      }
      if let publicRepository = try container.decodeIfPresent(
        RemoteRepositoryConfig.NpmRepository.PublicRepository.self, forKey: .publicRepository)
      {
        try upstreamCheckAndSet(.publicRepository(publicRepository))
      }
      if let customRepository = try container.decodeIfPresent(
        RemoteRepositoryConfig.NpmRepository.CustomRepository?.self, forKey: .customRepository)
      {
        try upstreamCheckAndSet(.customRepository(customRepository))
      }
      self.upstream = upstream
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.container(keyedBy: CodingKeys.self)

      if let choice = self.upstream {
        switch choice {
        case .publicRepository(let value):
          try container.encode(value, forKey: .publicRepository)
        case .customRepository(let value):
          try container.encode(value, forKey: .customRepository)
        }
      }
    }

    /// Customer-specified publicly available remote repository.
    public struct CustomRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// An http/https uri reference to the upstream remote repository, for ex:
      /// "https://my.npm.registry/".
      public var uri: Swift.String = Swift.String()

      /// Initialize a new instance of `CustomRepository`.
      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 = CustomRepository().with { $0.uri = ... }
      /// ```
      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.devtools.artifactregistry.v1.RemoteRepositoryConfig.NpmRepository.CustomRepository"
      }
      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)
      }
    }

    /// Predefined list of publicly available NPM repositories like npmjs.
    public enum PublicRepository: Codable, Equatable, Sendable {
      /// Unspecified repository.
      case unspecified
      /// npmjs.
      case npmjs
      /// Encodes an unknown integer value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownIntValue(Int)
      /// Encodes an unknown string value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownStringValue(String)

      public init() {
        self = .unspecified
      }

      /// Returns the integer value associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown string value, this returns `nil`.
      public var intValue: Int? {
        switch self {
        case .unspecified: return 0
        case .npmjs: return 1
        case .unknownIntValue(let v): return v
        case .unknownStringValue: return nil
        }
      }

      /// Returns the string value (or name) associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
      public var stringValue: Swift.String? {
        switch self {
        case .unspecified: return "PUBLIC_REPOSITORY_UNSPECIFIED"
        case .npmjs: return "NPMJS"
        case .unknownIntValue: return nil
        case .unknownStringValue(let v): return v
        }
      }

      /// Initialize from a string value.
      ///
      /// If the value is unknown, this initializes to [`unknownStringValue`](doc:PublicRepository/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "PUBLIC_REPOSITORY_UNSPECIFIED": self = .unspecified
        case "NPMJS": self = .npmjs
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:PublicRepository/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .unspecified
        case 1: self = .npmjs
        default: self = .unknownIntValue(intValue)
        }
      }

      public init(from decoder: Decoder) throws {
        let container = try decoder.singleValueContainer()
        if let v = try? container.decode(Int.self) {
          self.init(intValue: v)
          return
        }
        if let s = try? container.decode(String.self) {
          if let v = Int(s) {
            self.init(intValue: v)
          } else {
            self.init(stringValue: s)
          }
          return
        }
        throw DecodingError.dataCorruptedError(
          in: container, debugDescription: "Expected enum value, must be integer or string.")
      }

      public func encode(to encoder: Encoder) throws {
        var container = encoder.singleValueContainer()
        switch self {
        case .unspecified: return try container.encode(0)
        case .npmjs: return try container.encode(1)
        case .unknownIntValue(let v): return try container.encode(v)
        case .unknownStringValue(let v): return try container.encode(v)
        }
      }
    }

    /// Address of the remote repository
    public enum OneOf_Upstream: Codable, Equatable, Sendable {
      /// One of the publicly available Npm repositories supported by Artifact
      /// Registry.
      case publicRepository(RemoteRepositoryConfig.NpmRepository.PublicRepository)
      /// Customer-specified remote repository.
      indirect case customRepository(RemoteRepositoryConfig.NpmRepository.CustomRepository?)
    }

    public static var _anyTypeUrl: Swift.String {
      return
        "type.googleapis.com/google.devtools.artifactregistry.v1.RemoteRepositoryConfig.NpmRepository"
    }
    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)
    }
  }

  /// Configuration for a Python remote repository.
  public struct PythonRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Address of the remote repository.
    public var upstream: OneOf_Upstream? = nil

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

    private enum CodingKeys: Swift.String, CodingKey {
      case publicRepository = "publicRepository"
      case customRepository = "customRepository"
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.container(keyedBy: CodingKeys.self)

      var upstream: OneOf_Upstream? = nil
      let upstreamCheckAndSet = {
        if upstream != nil {
          throw DecodingError.dataCorrupted(
            DecodingError.Context(
              codingPath: decoder.codingPath,
              debugDescription: "Multiple values set for oneof 'upstream'"))
        }
        upstream = $0
      }
      if let publicRepository = try container.decodeIfPresent(
        RemoteRepositoryConfig.PythonRepository.PublicRepository.self, forKey: .publicRepository)
      {
        try upstreamCheckAndSet(.publicRepository(publicRepository))
      }
      if let customRepository = try container.decodeIfPresent(
        RemoteRepositoryConfig.PythonRepository.CustomRepository?.self, forKey: .customRepository)
      {
        try upstreamCheckAndSet(.customRepository(customRepository))
      }
      self.upstream = upstream
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.container(keyedBy: CodingKeys.self)

      if let choice = self.upstream {
        switch choice {
        case .publicRepository(let value):
          try container.encode(value, forKey: .publicRepository)
        case .customRepository(let value):
          try container.encode(value, forKey: .customRepository)
        }
      }
    }

    /// Customer-specified publicly available remote repository.
    public struct CustomRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// An http/https uri reference to the upstream remote repository, for ex:
      /// "https://my.python.registry/".
      public var uri: Swift.String = Swift.String()

      /// Initialize a new instance of `CustomRepository`.
      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 = CustomRepository().with { $0.uri = ... }
      /// ```
      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.devtools.artifactregistry.v1.RemoteRepositoryConfig.PythonRepository.CustomRepository"
      }
      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)
      }
    }

    /// Predefined list of publicly available Python repositories like PyPI.org.
    public enum PublicRepository: Codable, Equatable, Sendable {
      /// Unspecified repository.
      case unspecified
      /// PyPI.
      case pypi
      /// Encodes an unknown integer value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownIntValue(Int)
      /// Encodes an unknown string value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownStringValue(String)

      public init() {
        self = .unspecified
      }

      /// Returns the integer value associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown string value, this returns `nil`.
      public var intValue: Int? {
        switch self {
        case .unspecified: return 0
        case .pypi: return 1
        case .unknownIntValue(let v): return v
        case .unknownStringValue: return nil
        }
      }

      /// Returns the string value (or name) associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
      public var stringValue: Swift.String? {
        switch self {
        case .unspecified: return "PUBLIC_REPOSITORY_UNSPECIFIED"
        case .pypi: return "PYPI"
        case .unknownIntValue: return nil
        case .unknownStringValue(let v): return v
        }
      }

      /// Initialize from a string value.
      ///
      /// If the value is unknown, this initializes to [`unknownStringValue`](doc:PublicRepository/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "PUBLIC_REPOSITORY_UNSPECIFIED": self = .unspecified
        case "PYPI": self = .pypi
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:PublicRepository/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .unspecified
        case 1: self = .pypi
        default: self = .unknownIntValue(intValue)
        }
      }

      public init(from decoder: Decoder) throws {
        let container = try decoder.singleValueContainer()
        if let v = try? container.decode(Int.self) {
          self.init(intValue: v)
          return
        }
        if let s = try? container.decode(String.self) {
          if let v = Int(s) {
            self.init(intValue: v)
          } else {
            self.init(stringValue: s)
          }
          return
        }
        throw DecodingError.dataCorruptedError(
          in: container, debugDescription: "Expected enum value, must be integer or string.")
      }

      public func encode(to encoder: Encoder) throws {
        var container = encoder.singleValueContainer()
        switch self {
        case .unspecified: return try container.encode(0)
        case .pypi: return try container.encode(1)
        case .unknownIntValue(let v): return try container.encode(v)
        case .unknownStringValue(let v): return try container.encode(v)
        }
      }
    }

    /// Address of the remote repository.
    public enum OneOf_Upstream: Codable, Equatable, Sendable {
      /// One of the publicly available Python repositories supported by Artifact
      /// Registry.
      case publicRepository(RemoteRepositoryConfig.PythonRepository.PublicRepository)
      /// Customer-specified remote repository.
      indirect case customRepository(RemoteRepositoryConfig.PythonRepository.CustomRepository?)
    }

    public static var _anyTypeUrl: Swift.String {
      return
        "type.googleapis.com/google.devtools.artifactregistry.v1.RemoteRepositoryConfig.PythonRepository"
    }
    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)
    }
  }

  /// Configuration for an Apt remote repository.
  public struct AptRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Address of the remote repository.
    public var upstream: OneOf_Upstream? = nil

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

    private enum CodingKeys: Swift.String, CodingKey {
      case publicRepository = "publicRepository"
      case customRepository = "customRepository"
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.container(keyedBy: CodingKeys.self)

      var upstream: OneOf_Upstream? = nil
      let upstreamCheckAndSet = {
        if upstream != nil {
          throw DecodingError.dataCorrupted(
            DecodingError.Context(
              codingPath: decoder.codingPath,
              debugDescription: "Multiple values set for oneof 'upstream'"))
        }
        upstream = $0
      }
      if let publicRepository = try container.decodeIfPresent(
        RemoteRepositoryConfig.AptRepository.PublicRepository?.self, forKey: .publicRepository)
      {
        try upstreamCheckAndSet(.publicRepository(publicRepository))
      }
      if let customRepository = try container.decodeIfPresent(
        RemoteRepositoryConfig.AptRepository.CustomRepository?.self, forKey: .customRepository)
      {
        try upstreamCheckAndSet(.customRepository(customRepository))
      }
      self.upstream = upstream
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.container(keyedBy: CodingKeys.self)

      if let choice = self.upstream {
        switch choice {
        case .publicRepository(let value):
          try container.encode(value, forKey: .publicRepository)
        case .customRepository(let value):
          try container.encode(value, forKey: .customRepository)
        }
      }
    }

    /// Publicly available Apt repositories constructed from a common repository
    /// base and a custom repository path.
    public struct PublicRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// A common public repository base for Apt.
      public var repositoryBase:
        RemoteRepositoryConfig.AptRepository.PublicRepository.RepositoryBase =
          RemoteRepositoryConfig.AptRepository.PublicRepository.RepositoryBase()

      /// A custom field to define a path to a specific repository from the base.
      public var repositoryPath: Swift.String = Swift.String()

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

      /// Predefined list of publicly available repository bases for Apt.
      public enum RepositoryBase: Codable, Equatable, Sendable {
        /// Unspecified repository base.
        case unspecified
        /// Debian.
        case debian
        /// Ubuntu LTS/Pro.
        case ubuntu
        /// Archived Debian.
        case debianSnapshot
        /// Encodes an unknown integer value.
        ///
        /// The most common cause for an unknown values is for the service to send
        /// a value unknown to the library. We recommend you update your library to
        /// the latest version.
        case unknownIntValue(Int)
        /// Encodes an unknown string value.
        ///
        /// The most common cause for an unknown values is for the service to send
        /// a value unknown to the library. We recommend you update your library to
        /// the latest version.
        case unknownStringValue(String)

        public init() {
          self = .unspecified
        }

        /// Returns the integer value associated with the enumeration.
        ///
        /// If the enumeration was initialized with an unknown string value, this returns `nil`.
        public var intValue: Int? {
          switch self {
          case .unspecified: return 0
          case .debian: return 1
          case .ubuntu: return 2
          case .debianSnapshot: return 3
          case .unknownIntValue(let v): return v
          case .unknownStringValue: return nil
          }
        }

        /// Returns the string value (or name) associated with the enumeration.
        ///
        /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
        public var stringValue: Swift.String? {
          switch self {
          case .unspecified: return "REPOSITORY_BASE_UNSPECIFIED"
          case .debian: return "DEBIAN"
          case .ubuntu: return "UBUNTU"
          case .debianSnapshot: return "DEBIAN_SNAPSHOT"
          case .unknownIntValue: return nil
          case .unknownStringValue(let v): return v
          }
        }

        /// Initialize from a string value.
        ///
        /// If the value is unknown, this initializes to [`unknownStringValue`](doc:RepositoryBase/unknownStringValue(_:)).
        public init(stringValue: Swift.String) {
          switch stringValue {
          case "REPOSITORY_BASE_UNSPECIFIED": self = .unspecified
          case "DEBIAN": self = .debian
          case "UBUNTU": self = .ubuntu
          case "DEBIAN_SNAPSHOT": self = .debianSnapshot
          default: self = .unknownStringValue(stringValue)
          }
        }

        /// Initialize from an integer value.
        ///
        /// If the value is unknown, this initializes to [`unknownIntValue`](doc:RepositoryBase/unknownIntValue(_:)).
        public init(intValue: Int) {
          switch intValue {
          case 0: self = .unspecified
          case 1: self = .debian
          case 2: self = .ubuntu
          case 3: self = .debianSnapshot
          default: self = .unknownIntValue(intValue)
          }
        }

        public init(from decoder: Decoder) throws {
          let container = try decoder.singleValueContainer()
          if let v = try? container.decode(Int.self) {
            self.init(intValue: v)
            return
          }
          if let s = try? container.decode(String.self) {
            if let v = Int(s) {
              self.init(intValue: v)
            } else {
              self.init(stringValue: s)
            }
            return
          }
          throw DecodingError.dataCorruptedError(
            in: container, debugDescription: "Expected enum value, must be integer or string.")
        }

        public func encode(to encoder: Encoder) throws {
          var container = encoder.singleValueContainer()
          switch self {
          case .unspecified: return try container.encode(0)
          case .debian: return try container.encode(1)
          case .ubuntu: return try container.encode(2)
          case .debianSnapshot: return try container.encode(3)
          case .unknownIntValue(let v): return try container.encode(v)
          case .unknownStringValue(let v): return try container.encode(v)
          }
        }
      }

      public static var _anyTypeUrl: Swift.String {
        return
          "type.googleapis.com/google.devtools.artifactregistry.v1.RemoteRepositoryConfig.AptRepository.PublicRepository"
      }
      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)
      }
    }

    /// Customer-specified publicly available remote repository.
    public struct CustomRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// An http/https uri reference to the upstream remote repository, for ex:
      /// "https://my.apt.registry/".
      public var uri: Swift.String = Swift.String()

      /// Initialize a new instance of `CustomRepository`.
      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 = CustomRepository().with { $0.uri = ... }
      /// ```
      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.devtools.artifactregistry.v1.RemoteRepositoryConfig.AptRepository.CustomRepository"
      }
      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)
      }
    }

    /// Address of the remote repository.
    public enum OneOf_Upstream: Codable, Equatable, Sendable {
      /// One of the publicly available Apt repositories supported by Artifact
      /// Registry.
      indirect case publicRepository(RemoteRepositoryConfig.AptRepository.PublicRepository?)
      /// Customer-specified remote repository.
      indirect case customRepository(RemoteRepositoryConfig.AptRepository.CustomRepository?)
    }

    public static var _anyTypeUrl: Swift.String {
      return
        "type.googleapis.com/google.devtools.artifactregistry.v1.RemoteRepositoryConfig.AptRepository"
    }
    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)
    }
  }

  /// Configuration for a Yum remote repository.
  public struct YumRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Address of the remote repository.
    public var upstream: OneOf_Upstream? = nil

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

    private enum CodingKeys: Swift.String, CodingKey {
      case publicRepository = "publicRepository"
      case customRepository = "customRepository"
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.container(keyedBy: CodingKeys.self)

      var upstream: OneOf_Upstream? = nil
      let upstreamCheckAndSet = {
        if upstream != nil {
          throw DecodingError.dataCorrupted(
            DecodingError.Context(
              codingPath: decoder.codingPath,
              debugDescription: "Multiple values set for oneof 'upstream'"))
        }
        upstream = $0
      }
      if let publicRepository = try container.decodeIfPresent(
        RemoteRepositoryConfig.YumRepository.PublicRepository?.self, forKey: .publicRepository)
      {
        try upstreamCheckAndSet(.publicRepository(publicRepository))
      }
      if let customRepository = try container.decodeIfPresent(
        RemoteRepositoryConfig.YumRepository.CustomRepository?.self, forKey: .customRepository)
      {
        try upstreamCheckAndSet(.customRepository(customRepository))
      }
      self.upstream = upstream
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.container(keyedBy: CodingKeys.self)

      if let choice = self.upstream {
        switch choice {
        case .publicRepository(let value):
          try container.encode(value, forKey: .publicRepository)
        case .customRepository(let value):
          try container.encode(value, forKey: .customRepository)
        }
      }
    }

    /// Publicly available Yum repositories constructed from a common repository
    /// base and a custom repository path.
    public struct PublicRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// A common public repository base for Yum.
      public var repositoryBase:
        RemoteRepositoryConfig.YumRepository.PublicRepository.RepositoryBase =
          RemoteRepositoryConfig.YumRepository.PublicRepository.RepositoryBase()

      /// A custom field to define a path to a specific repository from the base.
      public var repositoryPath: Swift.String = Swift.String()

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

      /// Predefined list of publicly available repository bases for Yum.
      public enum RepositoryBase: Codable, Equatable, Sendable {
        /// Unspecified repository base.
        case unspecified
        /// CentOS.
        case centos
        /// CentOS Debug.
        case centosDebug
        /// CentOS Vault.
        case centosVault
        /// CentOS Stream.
        case centosStream
        /// Rocky.
        case rocky
        /// Fedora Extra Packages for Enterprise Linux (EPEL).
        case epel
        /// Encodes an unknown integer value.
        ///
        /// The most common cause for an unknown values is for the service to send
        /// a value unknown to the library. We recommend you update your library to
        /// the latest version.
        case unknownIntValue(Int)
        /// Encodes an unknown string value.
        ///
        /// The most common cause for an unknown values is for the service to send
        /// a value unknown to the library. We recommend you update your library to
        /// the latest version.
        case unknownStringValue(String)

        public init() {
          self = .unspecified
        }

        /// Returns the integer value associated with the enumeration.
        ///
        /// If the enumeration was initialized with an unknown string value, this returns `nil`.
        public var intValue: Int? {
          switch self {
          case .unspecified: return 0
          case .centos: return 1
          case .centosDebug: return 2
          case .centosVault: return 3
          case .centosStream: return 4
          case .rocky: return 5
          case .epel: return 6
          case .unknownIntValue(let v): return v
          case .unknownStringValue: return nil
          }
        }

        /// Returns the string value (or name) associated with the enumeration.
        ///
        /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
        public var stringValue: Swift.String? {
          switch self {
          case .unspecified: return "REPOSITORY_BASE_UNSPECIFIED"
          case .centos: return "CENTOS"
          case .centosDebug: return "CENTOS_DEBUG"
          case .centosVault: return "CENTOS_VAULT"
          case .centosStream: return "CENTOS_STREAM"
          case .rocky: return "ROCKY"
          case .epel: return "EPEL"
          case .unknownIntValue: return nil
          case .unknownStringValue(let v): return v
          }
        }

        /// Initialize from a string value.
        ///
        /// If the value is unknown, this initializes to [`unknownStringValue`](doc:RepositoryBase/unknownStringValue(_:)).
        public init(stringValue: Swift.String) {
          switch stringValue {
          case "REPOSITORY_BASE_UNSPECIFIED": self = .unspecified
          case "CENTOS": self = .centos
          case "CENTOS_DEBUG": self = .centosDebug
          case "CENTOS_VAULT": self = .centosVault
          case "CENTOS_STREAM": self = .centosStream
          case "ROCKY": self = .rocky
          case "EPEL": self = .epel
          default: self = .unknownStringValue(stringValue)
          }
        }

        /// Initialize from an integer value.
        ///
        /// If the value is unknown, this initializes to [`unknownIntValue`](doc:RepositoryBase/unknownIntValue(_:)).
        public init(intValue: Int) {
          switch intValue {
          case 0: self = .unspecified
          case 1: self = .centos
          case 2: self = .centosDebug
          case 3: self = .centosVault
          case 4: self = .centosStream
          case 5: self = .rocky
          case 6: self = .epel
          default: self = .unknownIntValue(intValue)
          }
        }

        public init(from decoder: Decoder) throws {
          let container = try decoder.singleValueContainer()
          if let v = try? container.decode(Int.self) {
            self.init(intValue: v)
            return
          }
          if let s = try? container.decode(String.self) {
            if let v = Int(s) {
              self.init(intValue: v)
            } else {
              self.init(stringValue: s)
            }
            return
          }
          throw DecodingError.dataCorruptedError(
            in: container, debugDescription: "Expected enum value, must be integer or string.")
        }

        public func encode(to encoder: Encoder) throws {
          var container = encoder.singleValueContainer()
          switch self {
          case .unspecified: return try container.encode(0)
          case .centos: return try container.encode(1)
          case .centosDebug: return try container.encode(2)
          case .centosVault: return try container.encode(3)
          case .centosStream: return try container.encode(4)
          case .rocky: return try container.encode(5)
          case .epel: return try container.encode(6)
          case .unknownIntValue(let v): return try container.encode(v)
          case .unknownStringValue(let v): return try container.encode(v)
          }
        }
      }

      public static var _anyTypeUrl: Swift.String {
        return
          "type.googleapis.com/google.devtools.artifactregistry.v1.RemoteRepositoryConfig.YumRepository.PublicRepository"
      }
      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)
      }
    }

    /// Customer-specified publicly available remote repository.
    public struct CustomRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// An http/https uri reference to the upstream remote repository, for ex:
      /// "https://my.yum.registry/".
      public var uri: Swift.String = Swift.String()

      /// Initialize a new instance of `CustomRepository`.
      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 = CustomRepository().with { $0.uri = ... }
      /// ```
      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.devtools.artifactregistry.v1.RemoteRepositoryConfig.YumRepository.CustomRepository"
      }
      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)
      }
    }

    /// Address of the remote repository.
    public enum OneOf_Upstream: Codable, Equatable, Sendable {
      /// One of the publicly available Yum repositories supported by Artifact
      /// Registry.
      indirect case publicRepository(RemoteRepositoryConfig.YumRepository.PublicRepository?)
      /// Customer-specified remote repository.
      indirect case customRepository(RemoteRepositoryConfig.YumRepository.CustomRepository?)
    }

    public static var _anyTypeUrl: Swift.String {
      return
        "type.googleapis.com/google.devtools.artifactregistry.v1.RemoteRepositoryConfig.YumRepository"
    }
    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)
    }
  }

  /// Common remote repository settings type.
  public struct CommonRemoteRepository: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Required. A common public repository base for remote repository.
    public var uri: Swift.String = Swift.String()

    /// Initialize a new instance of `CommonRemoteRepository`.
    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 = CommonRemoteRepository().with { $0.uri = ... }
    /// ```
    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.devtools.artifactregistry.v1.RemoteRepositoryConfig.CommonRemoteRepository"
    }
    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)
    }
  }

  /// Settings specific to the remote repository.
  public enum OneOf_RemoteSource: Codable, Equatable, Sendable {
    /// Specific settings for a Docker remote repository.
    indirect case dockerRepository(RemoteRepositoryConfig.DockerRepository?)
    /// Specific settings for a Maven remote repository.
    indirect case mavenRepository(RemoteRepositoryConfig.MavenRepository?)
    /// Specific settings for an Npm remote repository.
    indirect case npmRepository(RemoteRepositoryConfig.NpmRepository?)
    /// Specific settings for a Python remote repository.
    indirect case pythonRepository(RemoteRepositoryConfig.PythonRepository?)
    /// Specific settings for an Apt remote repository.
    indirect case aptRepository(RemoteRepositoryConfig.AptRepository?)
    /// Specific settings for a Yum remote repository.
    indirect case yumRepository(RemoteRepositoryConfig.YumRepository?)
    /// Common remote repository settings.
    /// Used as the remote repository upstream URL.
    indirect case commonRepository(RemoteRepositoryConfig.CommonRemoteRepository?)
  }

  public static var _anyTypeUrl: Swift.String {
    return "type.googleapis.com/google.devtools.artifactregistry.v1.RemoteRepositoryConfig"
  }
  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)
  }
}
