// 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 configuration for prefetch ads.
public struct PrefetchConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Required. Indicates whether the option to prefetch ad requests is enabled.
  public var enabled: Swift.Bool = Swift.Bool()

  /// The duration in seconds of the part of the break to be prefetched.
  /// This field is only relevant if prefetch is enabled.
  /// You should set this duration to as long as possible to increase the
  /// benefits of prefetching, but not longer than the shortest ad break
  /// expected. For example, for a live event with 30s and 60s ad breaks, the
  /// initial duration should be set to 30s.
  public var initialAdRequestDuration: GoogleCloudWkt.Duration? = nil

  /// Initialize a new instance of `PrefetchConfig`.
  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 = PrefetchConfig().with { $0.enabled = ... }
  /// ```
  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.video.stitcher.v1.PrefetchConfig"
  }
  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)
  }
}
