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

/// The body of a version resource. A version resource represents a
/// collection of components, such as files and other data. This may correspond
/// to a version in many package management schemes.
public struct Version: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// The name of the version, for example:
  /// `projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/art1`.
  /// If the package or version ID parts contain slashes, the slashes are
  /// escaped.
  public var name: Swift.String = Swift.String()

  /// Optional. Description of the version, as specified in its metadata.
  public var description: Swift.String = Swift.String()

  /// The time when the version was created.
  public var createTime: GoogleCloudWkt.Timestamp? = nil

  /// The time when the version was last updated.
  public var updateTime: GoogleCloudWkt.Timestamp? = nil

  /// Output only. A list of related tags. Will contain up to 100 tags that
  /// reference this version.
  public var relatedTags: [Tag] = []

  /// Output only. Repository-specific Metadata stored against this version.
  /// The fields returned are defined by the underlying repository-specific
  /// resource. Currently, the resources could be:
  /// [DockerImage][google.devtools.artifactregistry.v1.DockerImage]
  /// [MavenArtifact][google.devtools.artifactregistry.v1.MavenArtifact]
  ///
  /// [google.devtools.artifactregistry.v1.DockerImage]: <doc:DockerImage>
  /// [google.devtools.artifactregistry.v1.MavenArtifact]: <doc:MavenArtifact>
  public var metadata: GoogleCloudWkt.Struct? = nil

  /// Optional. Client specified annotations.
  public var annotations: [Swift.String: Swift.String] = [:]

  /// Output only. Immutable reference for the version, calculated based on the
  /// version's content. Currently we only support dirsum_sha256 hash algorithm.
  /// Additional hash algorithms may be added in the future.
  public var fingerprints: [Hash] = []

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