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

/// Metadata for a live session. The session expires 5 minutes after the client
/// stops fetching the session's playlists.
public struct LiveSession: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Output only. The name of the live session, in the form of
  /// `projects/{project}/locations/{location}/liveSessions/{id}`.
  public var name: Swift.String = Swift.String()

  /// Output only. The URI to play the live session's ad-stitched stream.
  public var playUri: Swift.String = Swift.String()

  /// Key value pairs for ad tag macro replacement, only available for live
  /// sessions that do not implement Google Ad manager ad insertion. If the
  /// specified ad tag URI has macros, this field provides the mapping to the
  /// value that will replace the macro in the ad tag URI.
  ///
  /// Macros are designated by square brackets, for example:
  ///
  ///   Ad tag URI: "https://doubleclick.google.com/ad/1?geo_id=[geoId]"
  ///
  ///   Ad tag macros: `{"geoId": "123"}`
  ///
  ///   Fully qualified ad tag:
  ///   `"https://doubleclick.google.com/ad/1?geo_id=123"`
  public var adTagMacros: [Swift.String: Swift.String] = [:]

  /// Additional options that affect the output of the manifest.
  public var manifestOptions: ManifestOptions? = nil

  /// This field should be set with appropriate values if GAM is being used for
  /// ads.
  public var gamSettings: LiveSession.GamSettings? = nil

  /// Required. The resource name of the live config for this session, in the
  /// form of `projects/{project}/locations/{location}/liveConfigs/{id}`.
  public var liveConfig: Swift.String = Swift.String()

  /// Determines how the ad should be tracked. This overrides the value set in
  /// the live config for this session.
  public var adTracking: AdTracking = AdTracking()

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

  /// Defines fields related to Google Ad Manager (GAM).
  public struct GamSettings: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Required. The stream ID generated by Ad Manager. This must be set if GAM
    /// is being used for ads and the session uses client-side ad tracking.
    public var streamId: Swift.String = Swift.String()

    /// [Targeting
    /// parameters](https://support.google.com/admanager/answer/7320899) to send
    /// to Ad Manager to generate a stream ID. This should only be set if the
    /// session uses server-side ad tracking.
    public var targetingParameters: [Swift.String: Swift.String] = [:]

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