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

/// Request message to create a new Execution of a Job.
public struct RunJobRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Required. The full name of the Job.
  /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
  /// can be project id or number.
  public var name: Swift.String = Swift.String()

  /// Indicates that the request should be validated without actually
  /// deleting any resources.
  public var validateOnly: Swift.Bool = Swift.Bool()

  /// A system-generated fingerprint for this version of the
  /// resource. May be used to detect modification conflict during updates.
  public var etag: Swift.String = Swift.String()

  /// Overrides specification for a given execution of a job. If provided,
  /// overrides will be applied to update the execution or task spec.
  public var overrides: RunJobRequest.Overrides? = nil

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

  /// RunJob Overrides that contains Execution fields to be overridden.
  public struct Overrides: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Per container override specification.
    public var containerOverrides: [RunJobRequest.Overrides.ContainerOverride] = []

    /// Optional. The desired number of tasks the execution should run. Will
    /// replace existing task_count value.
    public var taskCount: Swift.Int32 = Swift.Int32()

    /// Duration in seconds the task may be active before the system will
    /// actively try to mark it failed and kill associated containers. Will
    /// replace existing timeout_seconds value.
    public var timeout: GoogleCloudWkt.Duration? = nil

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

    /// Per-container override specification.
    public struct ContainerOverride: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// The name of the container specified as a DNS_LABEL.
      public var name: Swift.String = Swift.String()

      /// Optional. Arguments to the entrypoint. Will replace existing args for
      /// override.
      public var args: [Swift.String] = []

      /// List of environment variables to set in the container. Will be merged
      /// with existing env for override.
      public var env: [EnvVar] = []

      /// Optional. True if the intention is to clear out existing args list.
      public var clearArgs: Swift.Bool = Swift.Bool()

      /// Initialize a new instance of `ContainerOverride`.
      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 = ContainerOverride().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.cloud.run.v2.RunJobRequest.Overrides.ContainerOverride"
      }
      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 static var _anyTypeUrl: Swift.String {
      return "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides"
    }
    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 static var _anyTypeUrl: Swift.String {
    return "type.googleapis.com/google.cloud.run.v2.RunJobRequest"
  }
  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)
  }
}
