// 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 Attachment refers to additional metadata that can be attached to
/// artifacts in Artifact Registry. An attachment consists of one or more files.
public struct Attachment: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// The name of the attachment. E.g.
  /// `projects/p1/locations/us/repositories/repo/attachments/sbom`.
  public var name: Swift.String = Swift.String()

  /// Required. The target the attachment is for, can be a Version, Package or
  /// Repository. E.g.
  /// `projects/p1/locations/us-central1/repositories/repo1/packages/p1/versions/v1`.
  public var target: Swift.String = Swift.String()

  /// Type of attachment.
  /// E.g. `application/vnd.spdx+json`
  public var type: Swift.String = Swift.String()

  /// The namespace this attachment belongs to.
  /// E.g. If an attachment is created by artifact analysis, namespace is set
  /// to `artifactanalysis.googleapis.com`.
  public var attachmentNamespace: Swift.String = Swift.String()

  /// Optional. User annotations. These attributes can only be set and used by
  /// the user, and not by Artifact Registry. See
  /// https://google.aip.dev/128#annotations for more details such as format and
  /// size limitations.
  public var annotations: [Swift.String: Swift.String] = [:]

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

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

  /// Required. The files that belong to this attachment.
  /// If the file ID part contains slashes, they are escaped. E.g.
  /// `projects/p1/locations/us-central1/repositories/repo1/files/sha:<sha-of-file>`.
  public var files: [Swift.String] = []

  /// Output only. The name of the OCI version that this attachment created. Only
  /// populated for Docker attachments. E.g.
  /// `projects/p1/locations/us-central1/repositories/repo1/packages/p1/versions/v1`.
  public var ociVersionName: Swift.String = Swift.String()

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