// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark

part of 'schema.dart';

// **************************************************************************
// FreezedGenerator
// **************************************************************************

T _$identity<T>(T value) => value;

final _privateConstructorUsedError = UnsupportedError(
    'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');

ToolDefinition _$ToolDefinitionFromJson(Map<String, dynamic> json) {
  return _ToolDefinition.fromJson(json);
}

/// @nodoc
mixin _$ToolDefinition {
  /// The type of the tool, i.e. `function`.
  ToolType get type => throw _privateConstructorUsedError;

  /// The name of the function.
  String get name => throw _privateConstructorUsedError;

  /// The description of the function, including guidance on when and how
  /// to call it, and guidance about what to tell the user when calling
  /// (if anything).
  @JsonKey(includeIfNull: false)
  String? get description => throw _privateConstructorUsedError;

  /// Parameters of the function in JSON Schema.
  @JsonKey(includeIfNull: false)
  dynamic get parameters => throw _privateConstructorUsedError;

  /// Serializes this ToolDefinition to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of ToolDefinition
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $ToolDefinitionCopyWith<ToolDefinition> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $ToolDefinitionCopyWith<$Res> {
  factory $ToolDefinitionCopyWith(
          ToolDefinition value, $Res Function(ToolDefinition) then) =
      _$ToolDefinitionCopyWithImpl<$Res, ToolDefinition>;
  @useResult
  $Res call(
      {ToolType type,
      String name,
      @JsonKey(includeIfNull: false) String? description,
      @JsonKey(includeIfNull: false) dynamic parameters});
}

/// @nodoc
class _$ToolDefinitionCopyWithImpl<$Res, $Val extends ToolDefinition>
    implements $ToolDefinitionCopyWith<$Res> {
  _$ToolDefinitionCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of ToolDefinition
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? name = null,
    Object? description = freezed,
    Object? parameters = freezed,
  }) {
    return _then(_value.copyWith(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ToolType,
      name: null == name
          ? _value.name
          : name // ignore: cast_nullable_to_non_nullable
              as String,
      description: freezed == description
          ? _value.description
          : description // ignore: cast_nullable_to_non_nullable
              as String?,
      parameters: freezed == parameters
          ? _value.parameters
          : parameters // ignore: cast_nullable_to_non_nullable
              as dynamic,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$ToolDefinitionImplCopyWith<$Res>
    implements $ToolDefinitionCopyWith<$Res> {
  factory _$$ToolDefinitionImplCopyWith(_$ToolDefinitionImpl value,
          $Res Function(_$ToolDefinitionImpl) then) =
      __$$ToolDefinitionImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {ToolType type,
      String name,
      @JsonKey(includeIfNull: false) String? description,
      @JsonKey(includeIfNull: false) dynamic parameters});
}

/// @nodoc
class __$$ToolDefinitionImplCopyWithImpl<$Res>
    extends _$ToolDefinitionCopyWithImpl<$Res, _$ToolDefinitionImpl>
    implements _$$ToolDefinitionImplCopyWith<$Res> {
  __$$ToolDefinitionImplCopyWithImpl(
      _$ToolDefinitionImpl _value, $Res Function(_$ToolDefinitionImpl) _then)
      : super(_value, _then);

  /// Create a copy of ToolDefinition
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? name = null,
    Object? description = freezed,
    Object? parameters = freezed,
  }) {
    return _then(_$ToolDefinitionImpl(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ToolType,
      name: null == name
          ? _value.name
          : name // ignore: cast_nullable_to_non_nullable
              as String,
      description: freezed == description
          ? _value.description
          : description // ignore: cast_nullable_to_non_nullable
              as String?,
      parameters: freezed == parameters
          ? _value.parameters
          : parameters // ignore: cast_nullable_to_non_nullable
              as dynamic,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ToolDefinitionImpl extends _ToolDefinition {
  const _$ToolDefinitionImpl(
      {this.type = ToolType.function,
      required this.name,
      @JsonKey(includeIfNull: false) this.description,
      @JsonKey(includeIfNull: false) this.parameters})
      : super._();

  factory _$ToolDefinitionImpl.fromJson(Map<String, dynamic> json) =>
      _$$ToolDefinitionImplFromJson(json);

  /// The type of the tool, i.e. `function`.
  @override
  @JsonKey()
  final ToolType type;

  /// The name of the function.
  @override
  final String name;

  /// The description of the function, including guidance on when and how
  /// to call it, and guidance about what to tell the user when calling
  /// (if anything).
  @override
  @JsonKey(includeIfNull: false)
  final String? description;

  /// Parameters of the function in JSON Schema.
  @override
  @JsonKey(includeIfNull: false)
  final dynamic parameters;

  @override
  String toString() {
    return 'ToolDefinition(type: $type, name: $name, description: $description, parameters: $parameters)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ToolDefinitionImpl &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.name, name) || other.name == name) &&
            (identical(other.description, description) ||
                other.description == description) &&
            const DeepCollectionEquality()
                .equals(other.parameters, parameters));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, type, name, description,
      const DeepCollectionEquality().hash(parameters));

  /// Create a copy of ToolDefinition
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ToolDefinitionImplCopyWith<_$ToolDefinitionImpl> get copyWith =>
      __$$ToolDefinitionImplCopyWithImpl<_$ToolDefinitionImpl>(
          this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$ToolDefinitionImplToJson(
      this,
    );
  }
}

abstract class _ToolDefinition extends ToolDefinition {
  const factory _ToolDefinition(
          {final ToolType type,
          required final String name,
          @JsonKey(includeIfNull: false) final String? description,
          @JsonKey(includeIfNull: false) final dynamic parameters}) =
      _$ToolDefinitionImpl;
  const _ToolDefinition._() : super._();

  factory _ToolDefinition.fromJson(Map<String, dynamic> json) =
      _$ToolDefinitionImpl.fromJson;

  /// The type of the tool, i.e. `function`.
  @override
  ToolType get type;

  /// The name of the function.
  @override
  String get name;

  /// The description of the function, including guidance on when and how
  /// to call it, and guidance about what to tell the user when calling
  /// (if anything).
  @override
  @JsonKey(includeIfNull: false)
  String? get description;

  /// Parameters of the function in JSON Schema.
  @override
  @JsonKey(includeIfNull: false)
  dynamic get parameters;

  /// Create a copy of ToolDefinition
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ToolDefinitionImplCopyWith<_$ToolDefinitionImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

ToolChoiceForced _$ToolChoiceForcedFromJson(Map<String, dynamic> json) {
  return _ToolChoiceForced.fromJson(json);
}

/// @nodoc
mixin _$ToolChoiceForced {
  /// The type of the tool. Currently, only `function` is supported.
  ToolType get type => throw _privateConstructorUsedError;

  /// The name of the function to call.
  String get name => throw _privateConstructorUsedError;

  /// Serializes this ToolChoiceForced to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of ToolChoiceForced
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $ToolChoiceForcedCopyWith<ToolChoiceForced> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $ToolChoiceForcedCopyWith<$Res> {
  factory $ToolChoiceForcedCopyWith(
          ToolChoiceForced value, $Res Function(ToolChoiceForced) then) =
      _$ToolChoiceForcedCopyWithImpl<$Res, ToolChoiceForced>;
  @useResult
  $Res call({ToolType type, String name});
}

/// @nodoc
class _$ToolChoiceForcedCopyWithImpl<$Res, $Val extends ToolChoiceForced>
    implements $ToolChoiceForcedCopyWith<$Res> {
  _$ToolChoiceForcedCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of ToolChoiceForced
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? name = null,
  }) {
    return _then(_value.copyWith(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ToolType,
      name: null == name
          ? _value.name
          : name // ignore: cast_nullable_to_non_nullable
              as String,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$ToolChoiceForcedImplCopyWith<$Res>
    implements $ToolChoiceForcedCopyWith<$Res> {
  factory _$$ToolChoiceForcedImplCopyWith(_$ToolChoiceForcedImpl value,
          $Res Function(_$ToolChoiceForcedImpl) then) =
      __$$ToolChoiceForcedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call({ToolType type, String name});
}

/// @nodoc
class __$$ToolChoiceForcedImplCopyWithImpl<$Res>
    extends _$ToolChoiceForcedCopyWithImpl<$Res, _$ToolChoiceForcedImpl>
    implements _$$ToolChoiceForcedImplCopyWith<$Res> {
  __$$ToolChoiceForcedImplCopyWithImpl(_$ToolChoiceForcedImpl _value,
      $Res Function(_$ToolChoiceForcedImpl) _then)
      : super(_value, _then);

  /// Create a copy of ToolChoiceForced
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? name = null,
  }) {
    return _then(_$ToolChoiceForcedImpl(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ToolType,
      name: null == name
          ? _value.name
          : name // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ToolChoiceForcedImpl extends _ToolChoiceForced {
  const _$ToolChoiceForcedImpl(
      {this.type = ToolType.function, required this.name})
      : super._();

  factory _$ToolChoiceForcedImpl.fromJson(Map<String, dynamic> json) =>
      _$$ToolChoiceForcedImplFromJson(json);

  /// The type of the tool. Currently, only `function` is supported.
  @override
  @JsonKey()
  final ToolType type;

  /// The name of the function to call.
  @override
  final String name;

  @override
  String toString() {
    return 'ToolChoiceForced(type: $type, name: $name)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ToolChoiceForcedImpl &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.name, name) || other.name == name));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, type, name);

  /// Create a copy of ToolChoiceForced
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ToolChoiceForcedImplCopyWith<_$ToolChoiceForcedImpl> get copyWith =>
      __$$ToolChoiceForcedImplCopyWithImpl<_$ToolChoiceForcedImpl>(
          this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$ToolChoiceForcedImplToJson(
      this,
    );
  }
}

abstract class _ToolChoiceForced extends ToolChoiceForced {
  const factory _ToolChoiceForced(
      {final ToolType type,
      required final String name}) = _$ToolChoiceForcedImpl;
  const _ToolChoiceForced._() : super._();

  factory _ToolChoiceForced.fromJson(Map<String, dynamic> json) =
      _$ToolChoiceForcedImpl.fromJson;

  /// The type of the tool. Currently, only `function` is supported.
  @override
  ToolType get type;

  /// The name of the function to call.
  @override
  String get name;

  /// Create a copy of ToolChoiceForced
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ToolChoiceForcedImplCopyWith<_$ToolChoiceForcedImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

InputAudioTranscriptionConfig _$InputAudioTranscriptionConfigFromJson(
    Map<String, dynamic> json) {
  return _InputAudioTranscriptionConfig.fromJson(json);
}

/// @nodoc
mixin _$InputAudioTranscriptionConfig {
  /// Whether input audio transcription is enabled.
  @JsonKey(includeIfNull: false)
  bool? get enabled => throw _privateConstructorUsedError;

  /// The model to use for transcription, `whisper-1` is the only currently
  /// supported model.
  @JsonKey(includeIfNull: false)
  String? get model => throw _privateConstructorUsedError;

  /// Serializes this InputAudioTranscriptionConfig to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of InputAudioTranscriptionConfig
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $InputAudioTranscriptionConfigCopyWith<InputAudioTranscriptionConfig>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $InputAudioTranscriptionConfigCopyWith<$Res> {
  factory $InputAudioTranscriptionConfigCopyWith(
          InputAudioTranscriptionConfig value,
          $Res Function(InputAudioTranscriptionConfig) then) =
      _$InputAudioTranscriptionConfigCopyWithImpl<$Res,
          InputAudioTranscriptionConfig>;
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) bool? enabled,
      @JsonKey(includeIfNull: false) String? model});
}

/// @nodoc
class _$InputAudioTranscriptionConfigCopyWithImpl<$Res,
        $Val extends InputAudioTranscriptionConfig>
    implements $InputAudioTranscriptionConfigCopyWith<$Res> {
  _$InputAudioTranscriptionConfigCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of InputAudioTranscriptionConfig
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? enabled = freezed,
    Object? model = freezed,
  }) {
    return _then(_value.copyWith(
      enabled: freezed == enabled
          ? _value.enabled
          : enabled // ignore: cast_nullable_to_non_nullable
              as bool?,
      model: freezed == model
          ? _value.model
          : model // ignore: cast_nullable_to_non_nullable
              as String?,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$InputAudioTranscriptionConfigImplCopyWith<$Res>
    implements $InputAudioTranscriptionConfigCopyWith<$Res> {
  factory _$$InputAudioTranscriptionConfigImplCopyWith(
          _$InputAudioTranscriptionConfigImpl value,
          $Res Function(_$InputAudioTranscriptionConfigImpl) then) =
      __$$InputAudioTranscriptionConfigImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) bool? enabled,
      @JsonKey(includeIfNull: false) String? model});
}

/// @nodoc
class __$$InputAudioTranscriptionConfigImplCopyWithImpl<$Res>
    extends _$InputAudioTranscriptionConfigCopyWithImpl<$Res,
        _$InputAudioTranscriptionConfigImpl>
    implements _$$InputAudioTranscriptionConfigImplCopyWith<$Res> {
  __$$InputAudioTranscriptionConfigImplCopyWithImpl(
      _$InputAudioTranscriptionConfigImpl _value,
      $Res Function(_$InputAudioTranscriptionConfigImpl) _then)
      : super(_value, _then);

  /// Create a copy of InputAudioTranscriptionConfig
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? enabled = freezed,
    Object? model = freezed,
  }) {
    return _then(_$InputAudioTranscriptionConfigImpl(
      enabled: freezed == enabled
          ? _value.enabled
          : enabled // ignore: cast_nullable_to_non_nullable
              as bool?,
      model: freezed == model
          ? _value.model
          : model // ignore: cast_nullable_to_non_nullable
              as String?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$InputAudioTranscriptionConfigImpl
    extends _InputAudioTranscriptionConfig {
  const _$InputAudioTranscriptionConfigImpl(
      {@JsonKey(includeIfNull: false) this.enabled,
      @JsonKey(includeIfNull: false) this.model})
      : super._();

  factory _$InputAudioTranscriptionConfigImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$InputAudioTranscriptionConfigImplFromJson(json);

  /// Whether input audio transcription is enabled.
  @override
  @JsonKey(includeIfNull: false)
  final bool? enabled;

  /// The model to use for transcription, `whisper-1` is the only currently
  /// supported model.
  @override
  @JsonKey(includeIfNull: false)
  final String? model;

  @override
  String toString() {
    return 'InputAudioTranscriptionConfig(enabled: $enabled, model: $model)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$InputAudioTranscriptionConfigImpl &&
            (identical(other.enabled, enabled) || other.enabled == enabled) &&
            (identical(other.model, model) || other.model == model));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, enabled, model);

  /// Create a copy of InputAudioTranscriptionConfig
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$InputAudioTranscriptionConfigImplCopyWith<
          _$InputAudioTranscriptionConfigImpl>
      get copyWith => __$$InputAudioTranscriptionConfigImplCopyWithImpl<
          _$InputAudioTranscriptionConfigImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$InputAudioTranscriptionConfigImplToJson(
      this,
    );
  }
}

abstract class _InputAudioTranscriptionConfig
    extends InputAudioTranscriptionConfig {
  const factory _InputAudioTranscriptionConfig(
          {@JsonKey(includeIfNull: false) final bool? enabled,
          @JsonKey(includeIfNull: false) final String? model}) =
      _$InputAudioTranscriptionConfigImpl;
  const _InputAudioTranscriptionConfig._() : super._();

  factory _InputAudioTranscriptionConfig.fromJson(Map<String, dynamic> json) =
      _$InputAudioTranscriptionConfigImpl.fromJson;

  /// Whether input audio transcription is enabled.
  @override
  @JsonKey(includeIfNull: false)
  bool? get enabled;

  /// The model to use for transcription, `whisper-1` is the only currently
  /// supported model.
  @override
  @JsonKey(includeIfNull: false)
  String? get model;

  /// Create a copy of InputAudioTranscriptionConfig
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$InputAudioTranscriptionConfigImplCopyWith<
          _$InputAudioTranscriptionConfigImpl>
      get copyWith => throw _privateConstructorUsedError;
}

TurnDetection _$TurnDetectionFromJson(Map<String, dynamic> json) {
  return _TurnDetection.fromJson(json);
}

/// @nodoc
mixin _$TurnDetection {
  /// Type of turn detection, only `server_vad` is currently supported.
  TurnDetectionType get type => throw _privateConstructorUsedError;

  /// Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A
  /// higher threshold will require louder audio to activate the model, and
  /// thus might perform better in noisy environments.
  @JsonKey(includeIfNull: false)
  double? get threshold => throw _privateConstructorUsedError;

  /// Amount of audio to include before the VAD detected speech (in
  /// milliseconds). Defaults to 300ms.
  @JsonKey(name: 'prefix_padding_ms', includeIfNull: false)
  int? get prefixPaddingMs => throw _privateConstructorUsedError;

  /// Duration of silence to detect speech stop (in milliseconds). Defaults
  /// to 500ms. With shorter values the model will respond more quickly,
  /// but may jump in on short pauses from the user.
  @JsonKey(name: 'silence_duration_ms', includeIfNull: false)
  int? get silenceDurationMs => throw _privateConstructorUsedError;

  /// Serializes this TurnDetection to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of TurnDetection
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $TurnDetectionCopyWith<TurnDetection> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $TurnDetectionCopyWith<$Res> {
  factory $TurnDetectionCopyWith(
          TurnDetection value, $Res Function(TurnDetection) then) =
      _$TurnDetectionCopyWithImpl<$Res, TurnDetection>;
  @useResult
  $Res call(
      {TurnDetectionType type,
      @JsonKey(includeIfNull: false) double? threshold,
      @JsonKey(name: 'prefix_padding_ms', includeIfNull: false)
      int? prefixPaddingMs,
      @JsonKey(name: 'silence_duration_ms', includeIfNull: false)
      int? silenceDurationMs});
}

/// @nodoc
class _$TurnDetectionCopyWithImpl<$Res, $Val extends TurnDetection>
    implements $TurnDetectionCopyWith<$Res> {
  _$TurnDetectionCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of TurnDetection
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? threshold = freezed,
    Object? prefixPaddingMs = freezed,
    Object? silenceDurationMs = freezed,
  }) {
    return _then(_value.copyWith(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as TurnDetectionType,
      threshold: freezed == threshold
          ? _value.threshold
          : threshold // ignore: cast_nullable_to_non_nullable
              as double?,
      prefixPaddingMs: freezed == prefixPaddingMs
          ? _value.prefixPaddingMs
          : prefixPaddingMs // ignore: cast_nullable_to_non_nullable
              as int?,
      silenceDurationMs: freezed == silenceDurationMs
          ? _value.silenceDurationMs
          : silenceDurationMs // ignore: cast_nullable_to_non_nullable
              as int?,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$TurnDetectionImplCopyWith<$Res>
    implements $TurnDetectionCopyWith<$Res> {
  factory _$$TurnDetectionImplCopyWith(
          _$TurnDetectionImpl value, $Res Function(_$TurnDetectionImpl) then) =
      __$$TurnDetectionImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {TurnDetectionType type,
      @JsonKey(includeIfNull: false) double? threshold,
      @JsonKey(name: 'prefix_padding_ms', includeIfNull: false)
      int? prefixPaddingMs,
      @JsonKey(name: 'silence_duration_ms', includeIfNull: false)
      int? silenceDurationMs});
}

/// @nodoc
class __$$TurnDetectionImplCopyWithImpl<$Res>
    extends _$TurnDetectionCopyWithImpl<$Res, _$TurnDetectionImpl>
    implements _$$TurnDetectionImplCopyWith<$Res> {
  __$$TurnDetectionImplCopyWithImpl(
      _$TurnDetectionImpl _value, $Res Function(_$TurnDetectionImpl) _then)
      : super(_value, _then);

  /// Create a copy of TurnDetection
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? threshold = freezed,
    Object? prefixPaddingMs = freezed,
    Object? silenceDurationMs = freezed,
  }) {
    return _then(_$TurnDetectionImpl(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as TurnDetectionType,
      threshold: freezed == threshold
          ? _value.threshold
          : threshold // ignore: cast_nullable_to_non_nullable
              as double?,
      prefixPaddingMs: freezed == prefixPaddingMs
          ? _value.prefixPaddingMs
          : prefixPaddingMs // ignore: cast_nullable_to_non_nullable
              as int?,
      silenceDurationMs: freezed == silenceDurationMs
          ? _value.silenceDurationMs
          : silenceDurationMs // ignore: cast_nullable_to_non_nullable
              as int?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$TurnDetectionImpl extends _TurnDetection {
  const _$TurnDetectionImpl(
      {required this.type,
      @JsonKey(includeIfNull: false) this.threshold,
      @JsonKey(name: 'prefix_padding_ms', includeIfNull: false)
      this.prefixPaddingMs,
      @JsonKey(name: 'silence_duration_ms', includeIfNull: false)
      this.silenceDurationMs})
      : super._();

  factory _$TurnDetectionImpl.fromJson(Map<String, dynamic> json) =>
      _$$TurnDetectionImplFromJson(json);

  /// Type of turn detection, only `server_vad` is currently supported.
  @override
  final TurnDetectionType type;

  /// Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A
  /// higher threshold will require louder audio to activate the model, and
  /// thus might perform better in noisy environments.
  @override
  @JsonKey(includeIfNull: false)
  final double? threshold;

  /// Amount of audio to include before the VAD detected speech (in
  /// milliseconds). Defaults to 300ms.
  @override
  @JsonKey(name: 'prefix_padding_ms', includeIfNull: false)
  final int? prefixPaddingMs;

  /// Duration of silence to detect speech stop (in milliseconds). Defaults
  /// to 500ms. With shorter values the model will respond more quickly,
  /// but may jump in on short pauses from the user.
  @override
  @JsonKey(name: 'silence_duration_ms', includeIfNull: false)
  final int? silenceDurationMs;

  @override
  String toString() {
    return 'TurnDetection(type: $type, threshold: $threshold, prefixPaddingMs: $prefixPaddingMs, silenceDurationMs: $silenceDurationMs)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$TurnDetectionImpl &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.threshold, threshold) ||
                other.threshold == threshold) &&
            (identical(other.prefixPaddingMs, prefixPaddingMs) ||
                other.prefixPaddingMs == prefixPaddingMs) &&
            (identical(other.silenceDurationMs, silenceDurationMs) ||
                other.silenceDurationMs == silenceDurationMs));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(
      runtimeType, type, threshold, prefixPaddingMs, silenceDurationMs);

  /// Create a copy of TurnDetection
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$TurnDetectionImplCopyWith<_$TurnDetectionImpl> get copyWith =>
      __$$TurnDetectionImplCopyWithImpl<_$TurnDetectionImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$TurnDetectionImplToJson(
      this,
    );
  }
}

abstract class _TurnDetection extends TurnDetection {
  const factory _TurnDetection(
      {required final TurnDetectionType type,
      @JsonKey(includeIfNull: false) final double? threshold,
      @JsonKey(name: 'prefix_padding_ms', includeIfNull: false)
      final int? prefixPaddingMs,
      @JsonKey(name: 'silence_duration_ms', includeIfNull: false)
      final int? silenceDurationMs}) = _$TurnDetectionImpl;
  const _TurnDetection._() : super._();

  factory _TurnDetection.fromJson(Map<String, dynamic> json) =
      _$TurnDetectionImpl.fromJson;

  /// Type of turn detection, only `server_vad` is currently supported.
  @override
  TurnDetectionType get type;

  /// Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A
  /// higher threshold will require louder audio to activate the model, and
  /// thus might perform better in noisy environments.
  @override
  @JsonKey(includeIfNull: false)
  double? get threshold;

  /// Amount of audio to include before the VAD detected speech (in
  /// milliseconds). Defaults to 300ms.
  @override
  @JsonKey(name: 'prefix_padding_ms', includeIfNull: false)
  int? get prefixPaddingMs;

  /// Duration of silence to detect speech stop (in milliseconds). Defaults
  /// to 500ms. With shorter values the model will respond more quickly,
  /// but may jump in on short pauses from the user.
  @override
  @JsonKey(name: 'silence_duration_ms', includeIfNull: false)
  int? get silenceDurationMs;

  /// Create a copy of TurnDetection
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$TurnDetectionImplCopyWith<_$TurnDetectionImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

RateLimit _$RateLimitFromJson(Map<String, dynamic> json) {
  return _RateLimit.fromJson(json);
}

/// @nodoc
mixin _$RateLimit {
  /// The name of the rate limit (`requests`, `tokens`).
  RateLimitName get name => throw _privateConstructorUsedError;

  /// The maximum allowed value for the rate limit.
  int get limit => throw _privateConstructorUsedError;

  /// The remaining value before the limit is reached.
  int get remaining => throw _privateConstructorUsedError;

  /// Seconds until the rate limit resets.
  @JsonKey(name: 'reset_seconds')
  double get resetSeconds => throw _privateConstructorUsedError;

  /// Serializes this RateLimit to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of RateLimit
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $RateLimitCopyWith<RateLimit> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $RateLimitCopyWith<$Res> {
  factory $RateLimitCopyWith(RateLimit value, $Res Function(RateLimit) then) =
      _$RateLimitCopyWithImpl<$Res, RateLimit>;
  @useResult
  $Res call(
      {RateLimitName name,
      int limit,
      int remaining,
      @JsonKey(name: 'reset_seconds') double resetSeconds});
}

/// @nodoc
class _$RateLimitCopyWithImpl<$Res, $Val extends RateLimit>
    implements $RateLimitCopyWith<$Res> {
  _$RateLimitCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of RateLimit
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? name = null,
    Object? limit = null,
    Object? remaining = null,
    Object? resetSeconds = null,
  }) {
    return _then(_value.copyWith(
      name: null == name
          ? _value.name
          : name // ignore: cast_nullable_to_non_nullable
              as RateLimitName,
      limit: null == limit
          ? _value.limit
          : limit // ignore: cast_nullable_to_non_nullable
              as int,
      remaining: null == remaining
          ? _value.remaining
          : remaining // ignore: cast_nullable_to_non_nullable
              as int,
      resetSeconds: null == resetSeconds
          ? _value.resetSeconds
          : resetSeconds // ignore: cast_nullable_to_non_nullable
              as double,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$RateLimitImplCopyWith<$Res>
    implements $RateLimitCopyWith<$Res> {
  factory _$$RateLimitImplCopyWith(
          _$RateLimitImpl value, $Res Function(_$RateLimitImpl) then) =
      __$$RateLimitImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {RateLimitName name,
      int limit,
      int remaining,
      @JsonKey(name: 'reset_seconds') double resetSeconds});
}

/// @nodoc
class __$$RateLimitImplCopyWithImpl<$Res>
    extends _$RateLimitCopyWithImpl<$Res, _$RateLimitImpl>
    implements _$$RateLimitImplCopyWith<$Res> {
  __$$RateLimitImplCopyWithImpl(
      _$RateLimitImpl _value, $Res Function(_$RateLimitImpl) _then)
      : super(_value, _then);

  /// Create a copy of RateLimit
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? name = null,
    Object? limit = null,
    Object? remaining = null,
    Object? resetSeconds = null,
  }) {
    return _then(_$RateLimitImpl(
      name: null == name
          ? _value.name
          : name // ignore: cast_nullable_to_non_nullable
              as RateLimitName,
      limit: null == limit
          ? _value.limit
          : limit // ignore: cast_nullable_to_non_nullable
              as int,
      remaining: null == remaining
          ? _value.remaining
          : remaining // ignore: cast_nullable_to_non_nullable
              as int,
      resetSeconds: null == resetSeconds
          ? _value.resetSeconds
          : resetSeconds // ignore: cast_nullable_to_non_nullable
              as double,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RateLimitImpl extends _RateLimit {
  const _$RateLimitImpl(
      {required this.name,
      required this.limit,
      required this.remaining,
      @JsonKey(name: 'reset_seconds') required this.resetSeconds})
      : super._();

  factory _$RateLimitImpl.fromJson(Map<String, dynamic> json) =>
      _$$RateLimitImplFromJson(json);

  /// The name of the rate limit (`requests`, `tokens`).
  @override
  final RateLimitName name;

  /// The maximum allowed value for the rate limit.
  @override
  final int limit;

  /// The remaining value before the limit is reached.
  @override
  final int remaining;

  /// Seconds until the rate limit resets.
  @override
  @JsonKey(name: 'reset_seconds')
  final double resetSeconds;

  @override
  String toString() {
    return 'RateLimit(name: $name, limit: $limit, remaining: $remaining, resetSeconds: $resetSeconds)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RateLimitImpl &&
            (identical(other.name, name) || other.name == name) &&
            (identical(other.limit, limit) || other.limit == limit) &&
            (identical(other.remaining, remaining) ||
                other.remaining == remaining) &&
            (identical(other.resetSeconds, resetSeconds) ||
                other.resetSeconds == resetSeconds));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, name, limit, remaining, resetSeconds);

  /// Create a copy of RateLimit
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RateLimitImplCopyWith<_$RateLimitImpl> get copyWith =>
      __$$RateLimitImplCopyWithImpl<_$RateLimitImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$RateLimitImplToJson(
      this,
    );
  }
}

abstract class _RateLimit extends RateLimit {
  const factory _RateLimit(
          {required final RateLimitName name,
          required final int limit,
          required final int remaining,
          @JsonKey(name: 'reset_seconds') required final double resetSeconds}) =
      _$RateLimitImpl;
  const _RateLimit._() : super._();

  factory _RateLimit.fromJson(Map<String, dynamic> json) =
      _$RateLimitImpl.fromJson;

  /// The name of the rate limit (`requests`, `tokens`).
  @override
  RateLimitName get name;

  /// The maximum allowed value for the rate limit.
  @override
  int get limit;

  /// The remaining value before the limit is reached.
  @override
  int get remaining;

  /// Seconds until the rate limit resets.
  @override
  @JsonKey(name: 'reset_seconds')
  double get resetSeconds;

  /// Create a copy of RateLimit
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RateLimitImplCopyWith<_$RateLimitImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

Response _$ResponseFromJson(Map<String, dynamic> json) {
  return _Response.fromJson(json);
}

/// @nodoc
mixin _$Response {
  /// The unique ID of the response.
  String get id => throw _privateConstructorUsedError;

  /// The object type, must be "realtime.response".
  ObjectType get object => throw _privateConstructorUsedError;

  /// The status of the response.
  ResponseStatus get status => throw _privateConstructorUsedError;

  /// Additional details about the status.
  /// Any of: [ResponseStatusDetailsCancelled], [ResponseStatusDetailsIncomplete], [ResponseStatusDetailsFailed]
  @JsonKey(name: 'status_details', includeIfNull: false)
  ResponseStatusDetails? get statusDetails =>
      throw _privateConstructorUsedError;

  /// The list of output items generated by the response.
  List<Item> get output => throw _privateConstructorUsedError;

  /// Usage statistics for the Response, this will correspond to billing. A Realtime API session will
  /// maintain a conversation context and append new Items to the Conversation, thus output from
  /// previous turns (text and audio tokens) will become the input for later turns.
  @JsonKey(includeIfNull: false)
  Usage? get usage => throw _privateConstructorUsedError;

  /// Serializes this Response to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of Response
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $ResponseCopyWith<Response> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $ResponseCopyWith<$Res> {
  factory $ResponseCopyWith(Response value, $Res Function(Response) then) =
      _$ResponseCopyWithImpl<$Res, Response>;
  @useResult
  $Res call(
      {String id,
      ObjectType object,
      ResponseStatus status,
      @JsonKey(name: 'status_details', includeIfNull: false)
      ResponseStatusDetails? statusDetails,
      List<Item> output,
      @JsonKey(includeIfNull: false) Usage? usage});

  $ResponseStatusDetailsCopyWith<$Res>? get statusDetails;
  $UsageCopyWith<$Res>? get usage;
}

/// @nodoc
class _$ResponseCopyWithImpl<$Res, $Val extends Response>
    implements $ResponseCopyWith<$Res> {
  _$ResponseCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of Response
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? id = null,
    Object? object = null,
    Object? status = null,
    Object? statusDetails = freezed,
    Object? output = null,
    Object? usage = freezed,
  }) {
    return _then(_value.copyWith(
      id: null == id
          ? _value.id
          : id // ignore: cast_nullable_to_non_nullable
              as String,
      object: null == object
          ? _value.object
          : object // ignore: cast_nullable_to_non_nullable
              as ObjectType,
      status: null == status
          ? _value.status
          : status // ignore: cast_nullable_to_non_nullable
              as ResponseStatus,
      statusDetails: freezed == statusDetails
          ? _value.statusDetails
          : statusDetails // ignore: cast_nullable_to_non_nullable
              as ResponseStatusDetails?,
      output: null == output
          ? _value.output
          : output // ignore: cast_nullable_to_non_nullable
              as List<Item>,
      usage: freezed == usage
          ? _value.usage
          : usage // ignore: cast_nullable_to_non_nullable
              as Usage?,
    ) as $Val);
  }

  /// Create a copy of Response
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ResponseStatusDetailsCopyWith<$Res>? get statusDetails {
    if (_value.statusDetails == null) {
      return null;
    }

    return $ResponseStatusDetailsCopyWith<$Res>(_value.statusDetails!, (value) {
      return _then(_value.copyWith(statusDetails: value) as $Val);
    });
  }

  /// Create a copy of Response
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $UsageCopyWith<$Res>? get usage {
    if (_value.usage == null) {
      return null;
    }

    return $UsageCopyWith<$Res>(_value.usage!, (value) {
      return _then(_value.copyWith(usage: value) as $Val);
    });
  }
}

/// @nodoc
abstract class _$$ResponseImplCopyWith<$Res>
    implements $ResponseCopyWith<$Res> {
  factory _$$ResponseImplCopyWith(
          _$ResponseImpl value, $Res Function(_$ResponseImpl) then) =
      __$$ResponseImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {String id,
      ObjectType object,
      ResponseStatus status,
      @JsonKey(name: 'status_details', includeIfNull: false)
      ResponseStatusDetails? statusDetails,
      List<Item> output,
      @JsonKey(includeIfNull: false) Usage? usage});

  @override
  $ResponseStatusDetailsCopyWith<$Res>? get statusDetails;
  @override
  $UsageCopyWith<$Res>? get usage;
}

/// @nodoc
class __$$ResponseImplCopyWithImpl<$Res>
    extends _$ResponseCopyWithImpl<$Res, _$ResponseImpl>
    implements _$$ResponseImplCopyWith<$Res> {
  __$$ResponseImplCopyWithImpl(
      _$ResponseImpl _value, $Res Function(_$ResponseImpl) _then)
      : super(_value, _then);

  /// Create a copy of Response
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? id = null,
    Object? object = null,
    Object? status = null,
    Object? statusDetails = freezed,
    Object? output = null,
    Object? usage = freezed,
  }) {
    return _then(_$ResponseImpl(
      id: null == id
          ? _value.id
          : id // ignore: cast_nullable_to_non_nullable
              as String,
      object: null == object
          ? _value.object
          : object // ignore: cast_nullable_to_non_nullable
              as ObjectType,
      status: null == status
          ? _value.status
          : status // ignore: cast_nullable_to_non_nullable
              as ResponseStatus,
      statusDetails: freezed == statusDetails
          ? _value.statusDetails
          : statusDetails // ignore: cast_nullable_to_non_nullable
              as ResponseStatusDetails?,
      output: null == output
          ? _value._output
          : output // ignore: cast_nullable_to_non_nullable
              as List<Item>,
      usage: freezed == usage
          ? _value.usage
          : usage // ignore: cast_nullable_to_non_nullable
              as Usage?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ResponseImpl extends _Response {
  const _$ResponseImpl(
      {required this.id,
      this.object = ObjectType.realtimeResponse,
      required this.status,
      @JsonKey(name: 'status_details', includeIfNull: false) this.statusDetails,
      required final List<Item> output,
      @JsonKey(includeIfNull: false) this.usage})
      : _output = output,
        super._();

  factory _$ResponseImpl.fromJson(Map<String, dynamic> json) =>
      _$$ResponseImplFromJson(json);

  /// The unique ID of the response.
  @override
  final String id;

  /// The object type, must be "realtime.response".
  @override
  @JsonKey()
  final ObjectType object;

  /// The status of the response.
  @override
  final ResponseStatus status;

  /// Additional details about the status.
  /// Any of: [ResponseStatusDetailsCancelled], [ResponseStatusDetailsIncomplete], [ResponseStatusDetailsFailed]
  @override
  @JsonKey(name: 'status_details', includeIfNull: false)
  final ResponseStatusDetails? statusDetails;

  /// The list of output items generated by the response.
  final List<Item> _output;

  /// The list of output items generated by the response.
  @override
  List<Item> get output {
    if (_output is EqualUnmodifiableListView) return _output;
    // ignore: implicit_dynamic_type
    return EqualUnmodifiableListView(_output);
  }

  /// Usage statistics for the Response, this will correspond to billing. A Realtime API session will
  /// maintain a conversation context and append new Items to the Conversation, thus output from
  /// previous turns (text and audio tokens) will become the input for later turns.
  @override
  @JsonKey(includeIfNull: false)
  final Usage? usage;

  @override
  String toString() {
    return 'Response(id: $id, object: $object, status: $status, statusDetails: $statusDetails, output: $output, usage: $usage)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ResponseImpl &&
            (identical(other.id, id) || other.id == id) &&
            (identical(other.object, object) || other.object == object) &&
            (identical(other.status, status) || other.status == status) &&
            (identical(other.statusDetails, statusDetails) ||
                other.statusDetails == statusDetails) &&
            const DeepCollectionEquality().equals(other._output, _output) &&
            (identical(other.usage, usage) || other.usage == usage));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, id, object, status,
      statusDetails, const DeepCollectionEquality().hash(_output), usage);

  /// Create a copy of Response
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ResponseImplCopyWith<_$ResponseImpl> get copyWith =>
      __$$ResponseImplCopyWithImpl<_$ResponseImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$ResponseImplToJson(
      this,
    );
  }
}

abstract class _Response extends Response {
  const factory _Response(
      {required final String id,
      final ObjectType object,
      required final ResponseStatus status,
      @JsonKey(name: 'status_details', includeIfNull: false)
      final ResponseStatusDetails? statusDetails,
      required final List<Item> output,
      @JsonKey(includeIfNull: false) final Usage? usage}) = _$ResponseImpl;
  const _Response._() : super._();

  factory _Response.fromJson(Map<String, dynamic> json) =
      _$ResponseImpl.fromJson;

  /// The unique ID of the response.
  @override
  String get id;

  /// The object type, must be "realtime.response".
  @override
  ObjectType get object;

  /// The status of the response.
  @override
  ResponseStatus get status;

  /// Additional details about the status.
  /// Any of: [ResponseStatusDetailsCancelled], [ResponseStatusDetailsIncomplete], [ResponseStatusDetailsFailed]
  @override
  @JsonKey(name: 'status_details', includeIfNull: false)
  ResponseStatusDetails? get statusDetails;

  /// The list of output items generated by the response.
  @override
  List<Item> get output;

  /// Usage statistics for the Response, this will correspond to billing. A Realtime API session will
  /// maintain a conversation context and append new Items to the Conversation, thus output from
  /// previous turns (text and audio tokens) will become the input for later turns.
  @override
  @JsonKey(includeIfNull: false)
  Usage? get usage;

  /// Create a copy of Response
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ResponseImplCopyWith<_$ResponseImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

ResponseConfig _$ResponseConfigFromJson(Map<String, dynamic> json) {
  return _ResponseConfig.fromJson(json);
}

/// @nodoc
mixin _$ResponseConfig {
  /// The modalities for the response.
  @JsonKey(includeIfNull: false)
  List<Modality>? get modalities => throw _privateConstructorUsedError;

  /// Instructions for the model.
  @JsonKey(includeIfNull: false)
  String? get instructions => throw _privateConstructorUsedError;

  /// The voice the model uses to respond - one of `alloy`, `echo`, or `shimmer`.
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  Voice? get voice => throw _privateConstructorUsedError;

  /// The format of output audio.
  @JsonKey(
      name: 'output_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  AudioFormat? get outputAudioFormat => throw _privateConstructorUsedError;

  /// Tools (functions) available to the model.
  @JsonKey(includeIfNull: false)
  List<ToolDefinition>? get tools => throw _privateConstructorUsedError;

  /// How the model chooses tools.
  @_ResponseConfigToolChoiceConverter()
  @JsonKey(name: 'tool_choice', includeIfNull: false)
  ResponseConfigToolChoice? get toolChoice =>
      throw _privateConstructorUsedError;

  /// Sampling temperature.
  @JsonKey(includeIfNull: false)
  double? get temperature => throw _privateConstructorUsedError;

  /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf".
  @_ResponseConfigMaxResponseOutputTokensConverter()
  @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
  ResponseConfigMaxResponseOutputTokens? get maxResponseOutputTokens =>
      throw _privateConstructorUsedError;

  /// Serializes this ResponseConfig to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of ResponseConfig
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $ResponseConfigCopyWith<ResponseConfig> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $ResponseConfigCopyWith<$Res> {
  factory $ResponseConfigCopyWith(
          ResponseConfig value, $Res Function(ResponseConfig) then) =
      _$ResponseConfigCopyWithImpl<$Res, ResponseConfig>;
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) List<Modality>? modalities,
      @JsonKey(includeIfNull: false) String? instructions,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      Voice? voice,
      @JsonKey(
          name: 'output_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      AudioFormat? outputAudioFormat,
      @JsonKey(includeIfNull: false) List<ToolDefinition>? tools,
      @_ResponseConfigToolChoiceConverter()
      @JsonKey(name: 'tool_choice', includeIfNull: false)
      ResponseConfigToolChoice? toolChoice,
      @JsonKey(includeIfNull: false) double? temperature,
      @_ResponseConfigMaxResponseOutputTokensConverter()
      @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
      ResponseConfigMaxResponseOutputTokens? maxResponseOutputTokens});

  $ResponseConfigToolChoiceCopyWith<$Res>? get toolChoice;
  $ResponseConfigMaxResponseOutputTokensCopyWith<$Res>?
      get maxResponseOutputTokens;
}

/// @nodoc
class _$ResponseConfigCopyWithImpl<$Res, $Val extends ResponseConfig>
    implements $ResponseConfigCopyWith<$Res> {
  _$ResponseConfigCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of ResponseConfig
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? modalities = freezed,
    Object? instructions = freezed,
    Object? voice = freezed,
    Object? outputAudioFormat = freezed,
    Object? tools = freezed,
    Object? toolChoice = freezed,
    Object? temperature = freezed,
    Object? maxResponseOutputTokens = freezed,
  }) {
    return _then(_value.copyWith(
      modalities: freezed == modalities
          ? _value.modalities
          : modalities // ignore: cast_nullable_to_non_nullable
              as List<Modality>?,
      instructions: freezed == instructions
          ? _value.instructions
          : instructions // ignore: cast_nullable_to_non_nullable
              as String?,
      voice: freezed == voice
          ? _value.voice
          : voice // ignore: cast_nullable_to_non_nullable
              as Voice?,
      outputAudioFormat: freezed == outputAudioFormat
          ? _value.outputAudioFormat
          : outputAudioFormat // ignore: cast_nullable_to_non_nullable
              as AudioFormat?,
      tools: freezed == tools
          ? _value.tools
          : tools // ignore: cast_nullable_to_non_nullable
              as List<ToolDefinition>?,
      toolChoice: freezed == toolChoice
          ? _value.toolChoice
          : toolChoice // ignore: cast_nullable_to_non_nullable
              as ResponseConfigToolChoice?,
      temperature: freezed == temperature
          ? _value.temperature
          : temperature // ignore: cast_nullable_to_non_nullable
              as double?,
      maxResponseOutputTokens: freezed == maxResponseOutputTokens
          ? _value.maxResponseOutputTokens
          : maxResponseOutputTokens // ignore: cast_nullable_to_non_nullable
              as ResponseConfigMaxResponseOutputTokens?,
    ) as $Val);
  }

  /// Create a copy of ResponseConfig
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ResponseConfigToolChoiceCopyWith<$Res>? get toolChoice {
    if (_value.toolChoice == null) {
      return null;
    }

    return $ResponseConfigToolChoiceCopyWith<$Res>(_value.toolChoice!, (value) {
      return _then(_value.copyWith(toolChoice: value) as $Val);
    });
  }

  /// Create a copy of ResponseConfig
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ResponseConfigMaxResponseOutputTokensCopyWith<$Res>?
      get maxResponseOutputTokens {
    if (_value.maxResponseOutputTokens == null) {
      return null;
    }

    return $ResponseConfigMaxResponseOutputTokensCopyWith<$Res>(
        _value.maxResponseOutputTokens!, (value) {
      return _then(_value.copyWith(maxResponseOutputTokens: value) as $Val);
    });
  }
}

/// @nodoc
abstract class _$$ResponseConfigImplCopyWith<$Res>
    implements $ResponseConfigCopyWith<$Res> {
  factory _$$ResponseConfigImplCopyWith(_$ResponseConfigImpl value,
          $Res Function(_$ResponseConfigImpl) then) =
      __$$ResponseConfigImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) List<Modality>? modalities,
      @JsonKey(includeIfNull: false) String? instructions,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      Voice? voice,
      @JsonKey(
          name: 'output_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      AudioFormat? outputAudioFormat,
      @JsonKey(includeIfNull: false) List<ToolDefinition>? tools,
      @_ResponseConfigToolChoiceConverter()
      @JsonKey(name: 'tool_choice', includeIfNull: false)
      ResponseConfigToolChoice? toolChoice,
      @JsonKey(includeIfNull: false) double? temperature,
      @_ResponseConfigMaxResponseOutputTokensConverter()
      @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
      ResponseConfigMaxResponseOutputTokens? maxResponseOutputTokens});

  @override
  $ResponseConfigToolChoiceCopyWith<$Res>? get toolChoice;
  @override
  $ResponseConfigMaxResponseOutputTokensCopyWith<$Res>?
      get maxResponseOutputTokens;
}

/// @nodoc
class __$$ResponseConfigImplCopyWithImpl<$Res>
    extends _$ResponseConfigCopyWithImpl<$Res, _$ResponseConfigImpl>
    implements _$$ResponseConfigImplCopyWith<$Res> {
  __$$ResponseConfigImplCopyWithImpl(
      _$ResponseConfigImpl _value, $Res Function(_$ResponseConfigImpl) _then)
      : super(_value, _then);

  /// Create a copy of ResponseConfig
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? modalities = freezed,
    Object? instructions = freezed,
    Object? voice = freezed,
    Object? outputAudioFormat = freezed,
    Object? tools = freezed,
    Object? toolChoice = freezed,
    Object? temperature = freezed,
    Object? maxResponseOutputTokens = freezed,
  }) {
    return _then(_$ResponseConfigImpl(
      modalities: freezed == modalities
          ? _value._modalities
          : modalities // ignore: cast_nullable_to_non_nullable
              as List<Modality>?,
      instructions: freezed == instructions
          ? _value.instructions
          : instructions // ignore: cast_nullable_to_non_nullable
              as String?,
      voice: freezed == voice
          ? _value.voice
          : voice // ignore: cast_nullable_to_non_nullable
              as Voice?,
      outputAudioFormat: freezed == outputAudioFormat
          ? _value.outputAudioFormat
          : outputAudioFormat // ignore: cast_nullable_to_non_nullable
              as AudioFormat?,
      tools: freezed == tools
          ? _value._tools
          : tools // ignore: cast_nullable_to_non_nullable
              as List<ToolDefinition>?,
      toolChoice: freezed == toolChoice
          ? _value.toolChoice
          : toolChoice // ignore: cast_nullable_to_non_nullable
              as ResponseConfigToolChoice?,
      temperature: freezed == temperature
          ? _value.temperature
          : temperature // ignore: cast_nullable_to_non_nullable
              as double?,
      maxResponseOutputTokens: freezed == maxResponseOutputTokens
          ? _value.maxResponseOutputTokens
          : maxResponseOutputTokens // ignore: cast_nullable_to_non_nullable
              as ResponseConfigMaxResponseOutputTokens?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ResponseConfigImpl extends _ResponseConfig {
  const _$ResponseConfigImpl(
      {@JsonKey(includeIfNull: false) final List<Modality>? modalities,
      @JsonKey(includeIfNull: false) this.instructions,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.voice,
      @JsonKey(
          name: 'output_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.outputAudioFormat,
      @JsonKey(includeIfNull: false) final List<ToolDefinition>? tools,
      @_ResponseConfigToolChoiceConverter()
      @JsonKey(name: 'tool_choice', includeIfNull: false)
      this.toolChoice,
      @JsonKey(includeIfNull: false) this.temperature,
      @_ResponseConfigMaxResponseOutputTokensConverter()
      @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
      this.maxResponseOutputTokens})
      : _modalities = modalities,
        _tools = tools,
        super._();

  factory _$ResponseConfigImpl.fromJson(Map<String, dynamic> json) =>
      _$$ResponseConfigImplFromJson(json);

  /// The modalities for the response.
  final List<Modality>? _modalities;

  /// The modalities for the response.
  @override
  @JsonKey(includeIfNull: false)
  List<Modality>? get modalities {
    final value = _modalities;
    if (value == null) return null;
    if (_modalities is EqualUnmodifiableListView) return _modalities;
    // ignore: implicit_dynamic_type
    return EqualUnmodifiableListView(value);
  }

  /// Instructions for the model.
  @override
  @JsonKey(includeIfNull: false)
  final String? instructions;

  /// The voice the model uses to respond - one of `alloy`, `echo`, or `shimmer`.
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final Voice? voice;

  /// The format of output audio.
  @override
  @JsonKey(
      name: 'output_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final AudioFormat? outputAudioFormat;

  /// Tools (functions) available to the model.
  final List<ToolDefinition>? _tools;

  /// Tools (functions) available to the model.
  @override
  @JsonKey(includeIfNull: false)
  List<ToolDefinition>? get tools {
    final value = _tools;
    if (value == null) return null;
    if (_tools is EqualUnmodifiableListView) return _tools;
    // ignore: implicit_dynamic_type
    return EqualUnmodifiableListView(value);
  }

  /// How the model chooses tools.
  @override
  @_ResponseConfigToolChoiceConverter()
  @JsonKey(name: 'tool_choice', includeIfNull: false)
  final ResponseConfigToolChoice? toolChoice;

  /// Sampling temperature.
  @override
  @JsonKey(includeIfNull: false)
  final double? temperature;

  /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf".
  @override
  @_ResponseConfigMaxResponseOutputTokensConverter()
  @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
  final ResponseConfigMaxResponseOutputTokens? maxResponseOutputTokens;

  @override
  String toString() {
    return 'ResponseConfig(modalities: $modalities, instructions: $instructions, voice: $voice, outputAudioFormat: $outputAudioFormat, tools: $tools, toolChoice: $toolChoice, temperature: $temperature, maxResponseOutputTokens: $maxResponseOutputTokens)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ResponseConfigImpl &&
            const DeepCollectionEquality()
                .equals(other._modalities, _modalities) &&
            (identical(other.instructions, instructions) ||
                other.instructions == instructions) &&
            (identical(other.voice, voice) || other.voice == voice) &&
            (identical(other.outputAudioFormat, outputAudioFormat) ||
                other.outputAudioFormat == outputAudioFormat) &&
            const DeepCollectionEquality().equals(other._tools, _tools) &&
            (identical(other.toolChoice, toolChoice) ||
                other.toolChoice == toolChoice) &&
            (identical(other.temperature, temperature) ||
                other.temperature == temperature) &&
            (identical(
                    other.maxResponseOutputTokens, maxResponseOutputTokens) ||
                other.maxResponseOutputTokens == maxResponseOutputTokens));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(
      runtimeType,
      const DeepCollectionEquality().hash(_modalities),
      instructions,
      voice,
      outputAudioFormat,
      const DeepCollectionEquality().hash(_tools),
      toolChoice,
      temperature,
      maxResponseOutputTokens);

  /// Create a copy of ResponseConfig
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ResponseConfigImplCopyWith<_$ResponseConfigImpl> get copyWith =>
      __$$ResponseConfigImplCopyWithImpl<_$ResponseConfigImpl>(
          this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$ResponseConfigImplToJson(
      this,
    );
  }
}

abstract class _ResponseConfig extends ResponseConfig {
  const factory _ResponseConfig(
      {@JsonKey(includeIfNull: false) final List<Modality>? modalities,
      @JsonKey(includeIfNull: false) final String? instructions,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      final Voice? voice,
      @JsonKey(
          name: 'output_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      final AudioFormat? outputAudioFormat,
      @JsonKey(includeIfNull: false) final List<ToolDefinition>? tools,
      @_ResponseConfigToolChoiceConverter()
      @JsonKey(name: 'tool_choice', includeIfNull: false)
      final ResponseConfigToolChoice? toolChoice,
      @JsonKey(includeIfNull: false) final double? temperature,
      @_ResponseConfigMaxResponseOutputTokensConverter()
      @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
      final ResponseConfigMaxResponseOutputTokens?
          maxResponseOutputTokens}) = _$ResponseConfigImpl;
  const _ResponseConfig._() : super._();

  factory _ResponseConfig.fromJson(Map<String, dynamic> json) =
      _$ResponseConfigImpl.fromJson;

  /// The modalities for the response.
  @override
  @JsonKey(includeIfNull: false)
  List<Modality>? get modalities;

  /// Instructions for the model.
  @override
  @JsonKey(includeIfNull: false)
  String? get instructions;

  /// The voice the model uses to respond - one of `alloy`, `echo`, or `shimmer`.
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  Voice? get voice;

  /// The format of output audio.
  @override
  @JsonKey(
      name: 'output_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  AudioFormat? get outputAudioFormat;

  /// Tools (functions) available to the model.
  @override
  @JsonKey(includeIfNull: false)
  List<ToolDefinition>? get tools;

  /// How the model chooses tools.
  @override
  @_ResponseConfigToolChoiceConverter()
  @JsonKey(name: 'tool_choice', includeIfNull: false)
  ResponseConfigToolChoice? get toolChoice;

  /// Sampling temperature.
  @override
  @JsonKey(includeIfNull: false)
  double? get temperature;

  /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf".
  @override
  @_ResponseConfigMaxResponseOutputTokensConverter()
  @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
  ResponseConfigMaxResponseOutputTokens? get maxResponseOutputTokens;

  /// Create a copy of ResponseConfig
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ResponseConfigImplCopyWith<_$ResponseConfigImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

ResponseConfigToolChoice _$ResponseConfigToolChoiceFromJson(
    Map<String, dynamic> json) {
  switch (json['runtimeType']) {
    case 'mode':
      return ResponseConfigToolChoiceEnumeration.fromJson(json);
    case 'toolChoiceForced':
      return ResponseConfigToolChoiceToolChoiceForced.fromJson(json);

    default:
      throw CheckedFromJsonException(
          json,
          'runtimeType',
          'ResponseConfigToolChoice',
          'Invalid union type "${json['runtimeType']}"!');
  }
}

/// @nodoc
mixin _$ResponseConfigToolChoice {
  Object get value => throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(ResponseConfigToolChoiceMode value) mode,
    required TResult Function(ToolChoiceForced value) toolChoiceForced,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(ResponseConfigToolChoiceMode value)? mode,
    TResult? Function(ToolChoiceForced value)? toolChoiceForced,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(ResponseConfigToolChoiceMode value)? mode,
    TResult Function(ToolChoiceForced value)? toolChoiceForced,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ResponseConfigToolChoiceEnumeration value) mode,
    required TResult Function(ResponseConfigToolChoiceToolChoiceForced value)
        toolChoiceForced,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ResponseConfigToolChoiceEnumeration value)? mode,
    TResult? Function(ResponseConfigToolChoiceToolChoiceForced value)?
        toolChoiceForced,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ResponseConfigToolChoiceEnumeration value)? mode,
    TResult Function(ResponseConfigToolChoiceToolChoiceForced value)?
        toolChoiceForced,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;

  /// Serializes this ResponseConfigToolChoice to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $ResponseConfigToolChoiceCopyWith<$Res> {
  factory $ResponseConfigToolChoiceCopyWith(ResponseConfigToolChoice value,
          $Res Function(ResponseConfigToolChoice) then) =
      _$ResponseConfigToolChoiceCopyWithImpl<$Res, ResponseConfigToolChoice>;
}

/// @nodoc
class _$ResponseConfigToolChoiceCopyWithImpl<$Res,
        $Val extends ResponseConfigToolChoice>
    implements $ResponseConfigToolChoiceCopyWith<$Res> {
  _$ResponseConfigToolChoiceCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of ResponseConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
}

/// @nodoc
abstract class _$$ResponseConfigToolChoiceEnumerationImplCopyWith<$Res> {
  factory _$$ResponseConfigToolChoiceEnumerationImplCopyWith(
          _$ResponseConfigToolChoiceEnumerationImpl value,
          $Res Function(_$ResponseConfigToolChoiceEnumerationImpl) then) =
      __$$ResponseConfigToolChoiceEnumerationImplCopyWithImpl<$Res>;
  @useResult
  $Res call({ResponseConfigToolChoiceMode value});
}

/// @nodoc
class __$$ResponseConfigToolChoiceEnumerationImplCopyWithImpl<$Res>
    extends _$ResponseConfigToolChoiceCopyWithImpl<$Res,
        _$ResponseConfigToolChoiceEnumerationImpl>
    implements _$$ResponseConfigToolChoiceEnumerationImplCopyWith<$Res> {
  __$$ResponseConfigToolChoiceEnumerationImplCopyWithImpl(
      _$ResponseConfigToolChoiceEnumerationImpl _value,
      $Res Function(_$ResponseConfigToolChoiceEnumerationImpl) _then)
      : super(_value, _then);

  /// Create a copy of ResponseConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? value = null,
  }) {
    return _then(_$ResponseConfigToolChoiceEnumerationImpl(
      null == value
          ? _value.value
          : value // ignore: cast_nullable_to_non_nullable
              as ResponseConfigToolChoiceMode,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ResponseConfigToolChoiceEnumerationImpl
    extends ResponseConfigToolChoiceEnumeration {
  const _$ResponseConfigToolChoiceEnumerationImpl(this.value,
      {final String? $type})
      : $type = $type ?? 'mode',
        super._();

  factory _$ResponseConfigToolChoiceEnumerationImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$ResponseConfigToolChoiceEnumerationImplFromJson(json);

  @override
  final ResponseConfigToolChoiceMode value;

  @JsonKey(name: 'runtimeType')
  final String $type;

  @override
  String toString() {
    return 'ResponseConfigToolChoice.mode(value: $value)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ResponseConfigToolChoiceEnumerationImpl &&
            (identical(other.value, value) || other.value == value));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, value);

  /// Create a copy of ResponseConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ResponseConfigToolChoiceEnumerationImplCopyWith<
          _$ResponseConfigToolChoiceEnumerationImpl>
      get copyWith => __$$ResponseConfigToolChoiceEnumerationImplCopyWithImpl<
          _$ResponseConfigToolChoiceEnumerationImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(ResponseConfigToolChoiceMode value) mode,
    required TResult Function(ToolChoiceForced value) toolChoiceForced,
  }) {
    return mode(value);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(ResponseConfigToolChoiceMode value)? mode,
    TResult? Function(ToolChoiceForced value)? toolChoiceForced,
  }) {
    return mode?.call(value);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(ResponseConfigToolChoiceMode value)? mode,
    TResult Function(ToolChoiceForced value)? toolChoiceForced,
    required TResult orElse(),
  }) {
    if (mode != null) {
      return mode(value);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ResponseConfigToolChoiceEnumeration value) mode,
    required TResult Function(ResponseConfigToolChoiceToolChoiceForced value)
        toolChoiceForced,
  }) {
    return mode(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ResponseConfigToolChoiceEnumeration value)? mode,
    TResult? Function(ResponseConfigToolChoiceToolChoiceForced value)?
        toolChoiceForced,
  }) {
    return mode?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ResponseConfigToolChoiceEnumeration value)? mode,
    TResult Function(ResponseConfigToolChoiceToolChoiceForced value)?
        toolChoiceForced,
    required TResult orElse(),
  }) {
    if (mode != null) {
      return mode(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$ResponseConfigToolChoiceEnumerationImplToJson(
      this,
    );
  }
}

abstract class ResponseConfigToolChoiceEnumeration
    extends ResponseConfigToolChoice {
  const factory ResponseConfigToolChoiceEnumeration(
          final ResponseConfigToolChoiceMode value) =
      _$ResponseConfigToolChoiceEnumerationImpl;
  const ResponseConfigToolChoiceEnumeration._() : super._();

  factory ResponseConfigToolChoiceEnumeration.fromJson(
          Map<String, dynamic> json) =
      _$ResponseConfigToolChoiceEnumerationImpl.fromJson;

  @override
  ResponseConfigToolChoiceMode get value;

  /// Create a copy of ResponseConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ResponseConfigToolChoiceEnumerationImplCopyWith<
          _$ResponseConfigToolChoiceEnumerationImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWith<$Res> {
  factory _$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWith(
          _$ResponseConfigToolChoiceToolChoiceForcedImpl value,
          $Res Function(_$ResponseConfigToolChoiceToolChoiceForcedImpl) then) =
      __$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWithImpl<$Res>;
  @useResult
  $Res call({ToolChoiceForced value});

  $ToolChoiceForcedCopyWith<$Res> get value;
}

/// @nodoc
class __$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWithImpl<$Res>
    extends _$ResponseConfigToolChoiceCopyWithImpl<$Res,
        _$ResponseConfigToolChoiceToolChoiceForcedImpl>
    implements _$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWith<$Res> {
  __$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWithImpl(
      _$ResponseConfigToolChoiceToolChoiceForcedImpl _value,
      $Res Function(_$ResponseConfigToolChoiceToolChoiceForcedImpl) _then)
      : super(_value, _then);

  /// Create a copy of ResponseConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? value = null,
  }) {
    return _then(_$ResponseConfigToolChoiceToolChoiceForcedImpl(
      null == value
          ? _value.value
          : value // ignore: cast_nullable_to_non_nullable
              as ToolChoiceForced,
    ));
  }

  /// Create a copy of ResponseConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ToolChoiceForcedCopyWith<$Res> get value {
    return $ToolChoiceForcedCopyWith<$Res>(_value.value, (value) {
      return _then(_value.copyWith(value: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$ResponseConfigToolChoiceToolChoiceForcedImpl
    extends ResponseConfigToolChoiceToolChoiceForced {
  const _$ResponseConfigToolChoiceToolChoiceForcedImpl(this.value,
      {final String? $type})
      : $type = $type ?? 'toolChoiceForced',
        super._();

  factory _$ResponseConfigToolChoiceToolChoiceForcedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$ResponseConfigToolChoiceToolChoiceForcedImplFromJson(json);

  @override
  final ToolChoiceForced value;

  @JsonKey(name: 'runtimeType')
  final String $type;

  @override
  String toString() {
    return 'ResponseConfigToolChoice.toolChoiceForced(value: $value)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ResponseConfigToolChoiceToolChoiceForcedImpl &&
            (identical(other.value, value) || other.value == value));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, value);

  /// Create a copy of ResponseConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWith<
          _$ResponseConfigToolChoiceToolChoiceForcedImpl>
      get copyWith =>
          __$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWithImpl<
              _$ResponseConfigToolChoiceToolChoiceForcedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(ResponseConfigToolChoiceMode value) mode,
    required TResult Function(ToolChoiceForced value) toolChoiceForced,
  }) {
    return toolChoiceForced(value);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(ResponseConfigToolChoiceMode value)? mode,
    TResult? Function(ToolChoiceForced value)? toolChoiceForced,
  }) {
    return toolChoiceForced?.call(value);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(ResponseConfigToolChoiceMode value)? mode,
    TResult Function(ToolChoiceForced value)? toolChoiceForced,
    required TResult orElse(),
  }) {
    if (toolChoiceForced != null) {
      return toolChoiceForced(value);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ResponseConfigToolChoiceEnumeration value) mode,
    required TResult Function(ResponseConfigToolChoiceToolChoiceForced value)
        toolChoiceForced,
  }) {
    return toolChoiceForced(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ResponseConfigToolChoiceEnumeration value)? mode,
    TResult? Function(ResponseConfigToolChoiceToolChoiceForced value)?
        toolChoiceForced,
  }) {
    return toolChoiceForced?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ResponseConfigToolChoiceEnumeration value)? mode,
    TResult Function(ResponseConfigToolChoiceToolChoiceForced value)?
        toolChoiceForced,
    required TResult orElse(),
  }) {
    if (toolChoiceForced != null) {
      return toolChoiceForced(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$ResponseConfigToolChoiceToolChoiceForcedImplToJson(
      this,
    );
  }
}

abstract class ResponseConfigToolChoiceToolChoiceForced
    extends ResponseConfigToolChoice {
  const factory ResponseConfigToolChoiceToolChoiceForced(
          final ToolChoiceForced value) =
      _$ResponseConfigToolChoiceToolChoiceForcedImpl;
  const ResponseConfigToolChoiceToolChoiceForced._() : super._();

  factory ResponseConfigToolChoiceToolChoiceForced.fromJson(
          Map<String, dynamic> json) =
      _$ResponseConfigToolChoiceToolChoiceForcedImpl.fromJson;

  @override
  ToolChoiceForced get value;

  /// Create a copy of ResponseConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWith<
          _$ResponseConfigToolChoiceToolChoiceForcedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

ResponseConfigMaxResponseOutputTokens
    _$ResponseConfigMaxResponseOutputTokensFromJson(Map<String, dynamic> json) {
  switch (json['runtimeType']) {
    case 'int':
      return ResponseConfigMaxResponseOutputTokensInt.fromJson(json);
    case 'string':
      return ResponseConfigMaxResponseOutputTokensString.fromJson(json);

    default:
      throw CheckedFromJsonException(
          json,
          'runtimeType',
          'ResponseConfigMaxResponseOutputTokens',
          'Invalid union type "${json['runtimeType']}"!');
  }
}

/// @nodoc
mixin _$ResponseConfigMaxResponseOutputTokens {
  Object get value => throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(int value) int,
    required TResult Function(String value) string,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(int value)? int,
    TResult? Function(String value)? string,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(int value)? int,
    TResult Function(String value)? string,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ResponseConfigMaxResponseOutputTokensInt value)
        int,
    required TResult Function(ResponseConfigMaxResponseOutputTokensString value)
        string,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ResponseConfigMaxResponseOutputTokensInt value)? int,
    TResult? Function(ResponseConfigMaxResponseOutputTokensString value)?
        string,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ResponseConfigMaxResponseOutputTokensInt value)? int,
    TResult Function(ResponseConfigMaxResponseOutputTokensString value)? string,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;

  /// Serializes this ResponseConfigMaxResponseOutputTokens to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $ResponseConfigMaxResponseOutputTokensCopyWith<$Res> {
  factory $ResponseConfigMaxResponseOutputTokensCopyWith(
          ResponseConfigMaxResponseOutputTokens value,
          $Res Function(ResponseConfigMaxResponseOutputTokens) then) =
      _$ResponseConfigMaxResponseOutputTokensCopyWithImpl<$Res,
          ResponseConfigMaxResponseOutputTokens>;
}

/// @nodoc
class _$ResponseConfigMaxResponseOutputTokensCopyWithImpl<$Res,
        $Val extends ResponseConfigMaxResponseOutputTokens>
    implements $ResponseConfigMaxResponseOutputTokensCopyWith<$Res> {
  _$ResponseConfigMaxResponseOutputTokensCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of ResponseConfigMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
}

/// @nodoc
abstract class _$$ResponseConfigMaxResponseOutputTokensIntImplCopyWith<$Res> {
  factory _$$ResponseConfigMaxResponseOutputTokensIntImplCopyWith(
          _$ResponseConfigMaxResponseOutputTokensIntImpl value,
          $Res Function(_$ResponseConfigMaxResponseOutputTokensIntImpl) then) =
      __$$ResponseConfigMaxResponseOutputTokensIntImplCopyWithImpl<$Res>;
  @useResult
  $Res call({int value});
}

/// @nodoc
class __$$ResponseConfigMaxResponseOutputTokensIntImplCopyWithImpl<$Res>
    extends _$ResponseConfigMaxResponseOutputTokensCopyWithImpl<$Res,
        _$ResponseConfigMaxResponseOutputTokensIntImpl>
    implements _$$ResponseConfigMaxResponseOutputTokensIntImplCopyWith<$Res> {
  __$$ResponseConfigMaxResponseOutputTokensIntImplCopyWithImpl(
      _$ResponseConfigMaxResponseOutputTokensIntImpl _value,
      $Res Function(_$ResponseConfigMaxResponseOutputTokensIntImpl) _then)
      : super(_value, _then);

  /// Create a copy of ResponseConfigMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? value = null,
  }) {
    return _then(_$ResponseConfigMaxResponseOutputTokensIntImpl(
      null == value
          ? _value.value
          : value // ignore: cast_nullable_to_non_nullable
              as int,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ResponseConfigMaxResponseOutputTokensIntImpl
    extends ResponseConfigMaxResponseOutputTokensInt {
  const _$ResponseConfigMaxResponseOutputTokensIntImpl(this.value,
      {final String? $type})
      : $type = $type ?? 'int',
        super._();

  factory _$ResponseConfigMaxResponseOutputTokensIntImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$ResponseConfigMaxResponseOutputTokensIntImplFromJson(json);

  @override
  final int value;

  @JsonKey(name: 'runtimeType')
  final String $type;

  @override
  String toString() {
    return 'ResponseConfigMaxResponseOutputTokens.int(value: $value)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ResponseConfigMaxResponseOutputTokensIntImpl &&
            (identical(other.value, value) || other.value == value));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, value);

  /// Create a copy of ResponseConfigMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ResponseConfigMaxResponseOutputTokensIntImplCopyWith<
          _$ResponseConfigMaxResponseOutputTokensIntImpl>
      get copyWith =>
          __$$ResponseConfigMaxResponseOutputTokensIntImplCopyWithImpl<
              _$ResponseConfigMaxResponseOutputTokensIntImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(int value) int,
    required TResult Function(String value) string,
  }) {
    return int(value);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(int value)? int,
    TResult? Function(String value)? string,
  }) {
    return int?.call(value);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(int value)? int,
    TResult Function(String value)? string,
    required TResult orElse(),
  }) {
    if (int != null) {
      return int(value);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ResponseConfigMaxResponseOutputTokensInt value)
        int,
    required TResult Function(ResponseConfigMaxResponseOutputTokensString value)
        string,
  }) {
    return int(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ResponseConfigMaxResponseOutputTokensInt value)? int,
    TResult? Function(ResponseConfigMaxResponseOutputTokensString value)?
        string,
  }) {
    return int?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ResponseConfigMaxResponseOutputTokensInt value)? int,
    TResult Function(ResponseConfigMaxResponseOutputTokensString value)? string,
    required TResult orElse(),
  }) {
    if (int != null) {
      return int(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$ResponseConfigMaxResponseOutputTokensIntImplToJson(
      this,
    );
  }
}

abstract class ResponseConfigMaxResponseOutputTokensInt
    extends ResponseConfigMaxResponseOutputTokens {
  const factory ResponseConfigMaxResponseOutputTokensInt(final int value) =
      _$ResponseConfigMaxResponseOutputTokensIntImpl;
  const ResponseConfigMaxResponseOutputTokensInt._() : super._();

  factory ResponseConfigMaxResponseOutputTokensInt.fromJson(
          Map<String, dynamic> json) =
      _$ResponseConfigMaxResponseOutputTokensIntImpl.fromJson;

  @override
  int get value;

  /// Create a copy of ResponseConfigMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ResponseConfigMaxResponseOutputTokensIntImplCopyWith<
          _$ResponseConfigMaxResponseOutputTokensIntImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$ResponseConfigMaxResponseOutputTokensStringImplCopyWith<
    $Res> {
  factory _$$ResponseConfigMaxResponseOutputTokensStringImplCopyWith(
          _$ResponseConfigMaxResponseOutputTokensStringImpl value,
          $Res Function(_$ResponseConfigMaxResponseOutputTokensStringImpl)
              then) =
      __$$ResponseConfigMaxResponseOutputTokensStringImplCopyWithImpl<$Res>;
  @useResult
  $Res call({String value});
}

/// @nodoc
class __$$ResponseConfigMaxResponseOutputTokensStringImplCopyWithImpl<$Res>
    extends _$ResponseConfigMaxResponseOutputTokensCopyWithImpl<$Res,
        _$ResponseConfigMaxResponseOutputTokensStringImpl>
    implements
        _$$ResponseConfigMaxResponseOutputTokensStringImplCopyWith<$Res> {
  __$$ResponseConfigMaxResponseOutputTokensStringImplCopyWithImpl(
      _$ResponseConfigMaxResponseOutputTokensStringImpl _value,
      $Res Function(_$ResponseConfigMaxResponseOutputTokensStringImpl) _then)
      : super(_value, _then);

  /// Create a copy of ResponseConfigMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? value = null,
  }) {
    return _then(_$ResponseConfigMaxResponseOutputTokensStringImpl(
      null == value
          ? _value.value
          : value // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ResponseConfigMaxResponseOutputTokensStringImpl
    extends ResponseConfigMaxResponseOutputTokensString {
  const _$ResponseConfigMaxResponseOutputTokensStringImpl(this.value,
      {final String? $type})
      : $type = $type ?? 'string',
        super._();

  factory _$ResponseConfigMaxResponseOutputTokensStringImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$ResponseConfigMaxResponseOutputTokensStringImplFromJson(json);

  @override
  final String value;

  @JsonKey(name: 'runtimeType')
  final String $type;

  @override
  String toString() {
    return 'ResponseConfigMaxResponseOutputTokens.string(value: $value)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ResponseConfigMaxResponseOutputTokensStringImpl &&
            (identical(other.value, value) || other.value == value));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, value);

  /// Create a copy of ResponseConfigMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ResponseConfigMaxResponseOutputTokensStringImplCopyWith<
          _$ResponseConfigMaxResponseOutputTokensStringImpl>
      get copyWith =>
          __$$ResponseConfigMaxResponseOutputTokensStringImplCopyWithImpl<
                  _$ResponseConfigMaxResponseOutputTokensStringImpl>(
              this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(int value) int,
    required TResult Function(String value) string,
  }) {
    return string(value);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(int value)? int,
    TResult? Function(String value)? string,
  }) {
    return string?.call(value);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(int value)? int,
    TResult Function(String value)? string,
    required TResult orElse(),
  }) {
    if (string != null) {
      return string(value);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ResponseConfigMaxResponseOutputTokensInt value)
        int,
    required TResult Function(ResponseConfigMaxResponseOutputTokensString value)
        string,
  }) {
    return string(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ResponseConfigMaxResponseOutputTokensInt value)? int,
    TResult? Function(ResponseConfigMaxResponseOutputTokensString value)?
        string,
  }) {
    return string?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ResponseConfigMaxResponseOutputTokensInt value)? int,
    TResult Function(ResponseConfigMaxResponseOutputTokensString value)? string,
    required TResult orElse(),
  }) {
    if (string != null) {
      return string(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$ResponseConfigMaxResponseOutputTokensStringImplToJson(
      this,
    );
  }
}

abstract class ResponseConfigMaxResponseOutputTokensString
    extends ResponseConfigMaxResponseOutputTokens {
  const factory ResponseConfigMaxResponseOutputTokensString(
      final String value) = _$ResponseConfigMaxResponseOutputTokensStringImpl;
  const ResponseConfigMaxResponseOutputTokensString._() : super._();

  factory ResponseConfigMaxResponseOutputTokensString.fromJson(
          Map<String, dynamic> json) =
      _$ResponseConfigMaxResponseOutputTokensStringImpl.fromJson;

  @override
  String get value;

  /// Create a copy of ResponseConfigMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ResponseConfigMaxResponseOutputTokensStringImplCopyWith<
          _$ResponseConfigMaxResponseOutputTokensStringImpl>
      get copyWith => throw _privateConstructorUsedError;
}

Usage _$UsageFromJson(Map<String, dynamic> json) {
  return _Usage.fromJson(json);
}

/// @nodoc
mixin _$Usage {
  /// The total number of tokens in the Response including input and output text and audio tokens.
  @JsonKey(name: 'total_tokens', includeIfNull: false)
  int? get totalTokens => throw _privateConstructorUsedError;

  /// The number of input tokens used in the Response, including text and audio tokens.
  @JsonKey(name: 'input_tokens', includeIfNull: false)
  int? get inputTokens => throw _privateConstructorUsedError;

  /// The number of output tokens sent in the Response, including text and audio tokens.
  @JsonKey(name: 'output_tokens', includeIfNull: false)
  int? get outputTokens => throw _privateConstructorUsedError;

  /// Details about the input tokens used in the Response.
  @JsonKey(name: 'input_token_details', includeIfNull: false)
  UsageInputTokenDetails? get inputTokenDetails =>
      throw _privateConstructorUsedError;

  /// Details about the output tokens used in the Response.
  @JsonKey(name: 'output_token_details', includeIfNull: false)
  UsageOutputTokenDetails? get outputTokenDetails =>
      throw _privateConstructorUsedError;

  /// Serializes this Usage to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of Usage
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $UsageCopyWith<Usage> get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $UsageCopyWith<$Res> {
  factory $UsageCopyWith(Usage value, $Res Function(Usage) then) =
      _$UsageCopyWithImpl<$Res, Usage>;
  @useResult
  $Res call(
      {@JsonKey(name: 'total_tokens', includeIfNull: false) int? totalTokens,
      @JsonKey(name: 'input_tokens', includeIfNull: false) int? inputTokens,
      @JsonKey(name: 'output_tokens', includeIfNull: false) int? outputTokens,
      @JsonKey(name: 'input_token_details', includeIfNull: false)
      UsageInputTokenDetails? inputTokenDetails,
      @JsonKey(name: 'output_token_details', includeIfNull: false)
      UsageOutputTokenDetails? outputTokenDetails});

  $UsageInputTokenDetailsCopyWith<$Res>? get inputTokenDetails;
  $UsageOutputTokenDetailsCopyWith<$Res>? get outputTokenDetails;
}

/// @nodoc
class _$UsageCopyWithImpl<$Res, $Val extends Usage>
    implements $UsageCopyWith<$Res> {
  _$UsageCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of Usage
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? totalTokens = freezed,
    Object? inputTokens = freezed,
    Object? outputTokens = freezed,
    Object? inputTokenDetails = freezed,
    Object? outputTokenDetails = freezed,
  }) {
    return _then(_value.copyWith(
      totalTokens: freezed == totalTokens
          ? _value.totalTokens
          : totalTokens // ignore: cast_nullable_to_non_nullable
              as int?,
      inputTokens: freezed == inputTokens
          ? _value.inputTokens
          : inputTokens // ignore: cast_nullable_to_non_nullable
              as int?,
      outputTokens: freezed == outputTokens
          ? _value.outputTokens
          : outputTokens // ignore: cast_nullable_to_non_nullable
              as int?,
      inputTokenDetails: freezed == inputTokenDetails
          ? _value.inputTokenDetails
          : inputTokenDetails // ignore: cast_nullable_to_non_nullable
              as UsageInputTokenDetails?,
      outputTokenDetails: freezed == outputTokenDetails
          ? _value.outputTokenDetails
          : outputTokenDetails // ignore: cast_nullable_to_non_nullable
              as UsageOutputTokenDetails?,
    ) as $Val);
  }

  /// Create a copy of Usage
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $UsageInputTokenDetailsCopyWith<$Res>? get inputTokenDetails {
    if (_value.inputTokenDetails == null) {
      return null;
    }

    return $UsageInputTokenDetailsCopyWith<$Res>(_value.inputTokenDetails!,
        (value) {
      return _then(_value.copyWith(inputTokenDetails: value) as $Val);
    });
  }

  /// Create a copy of Usage
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $UsageOutputTokenDetailsCopyWith<$Res>? get outputTokenDetails {
    if (_value.outputTokenDetails == null) {
      return null;
    }

    return $UsageOutputTokenDetailsCopyWith<$Res>(_value.outputTokenDetails!,
        (value) {
      return _then(_value.copyWith(outputTokenDetails: value) as $Val);
    });
  }
}

/// @nodoc
abstract class _$$UsageImplCopyWith<$Res> implements $UsageCopyWith<$Res> {
  factory _$$UsageImplCopyWith(
          _$UsageImpl value, $Res Function(_$UsageImpl) then) =
      __$$UsageImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'total_tokens', includeIfNull: false) int? totalTokens,
      @JsonKey(name: 'input_tokens', includeIfNull: false) int? inputTokens,
      @JsonKey(name: 'output_tokens', includeIfNull: false) int? outputTokens,
      @JsonKey(name: 'input_token_details', includeIfNull: false)
      UsageInputTokenDetails? inputTokenDetails,
      @JsonKey(name: 'output_token_details', includeIfNull: false)
      UsageOutputTokenDetails? outputTokenDetails});

  @override
  $UsageInputTokenDetailsCopyWith<$Res>? get inputTokenDetails;
  @override
  $UsageOutputTokenDetailsCopyWith<$Res>? get outputTokenDetails;
}

/// @nodoc
class __$$UsageImplCopyWithImpl<$Res>
    extends _$UsageCopyWithImpl<$Res, _$UsageImpl>
    implements _$$UsageImplCopyWith<$Res> {
  __$$UsageImplCopyWithImpl(
      _$UsageImpl _value, $Res Function(_$UsageImpl) _then)
      : super(_value, _then);

  /// Create a copy of Usage
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? totalTokens = freezed,
    Object? inputTokens = freezed,
    Object? outputTokens = freezed,
    Object? inputTokenDetails = freezed,
    Object? outputTokenDetails = freezed,
  }) {
    return _then(_$UsageImpl(
      totalTokens: freezed == totalTokens
          ? _value.totalTokens
          : totalTokens // ignore: cast_nullable_to_non_nullable
              as int?,
      inputTokens: freezed == inputTokens
          ? _value.inputTokens
          : inputTokens // ignore: cast_nullable_to_non_nullable
              as int?,
      outputTokens: freezed == outputTokens
          ? _value.outputTokens
          : outputTokens // ignore: cast_nullable_to_non_nullable
              as int?,
      inputTokenDetails: freezed == inputTokenDetails
          ? _value.inputTokenDetails
          : inputTokenDetails // ignore: cast_nullable_to_non_nullable
              as UsageInputTokenDetails?,
      outputTokenDetails: freezed == outputTokenDetails
          ? _value.outputTokenDetails
          : outputTokenDetails // ignore: cast_nullable_to_non_nullable
              as UsageOutputTokenDetails?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$UsageImpl extends _Usage {
  const _$UsageImpl(
      {@JsonKey(name: 'total_tokens', includeIfNull: false) this.totalTokens,
      @JsonKey(name: 'input_tokens', includeIfNull: false) this.inputTokens,
      @JsonKey(name: 'output_tokens', includeIfNull: false) this.outputTokens,
      @JsonKey(name: 'input_token_details', includeIfNull: false)
      this.inputTokenDetails,
      @JsonKey(name: 'output_token_details', includeIfNull: false)
      this.outputTokenDetails})
      : super._();

  factory _$UsageImpl.fromJson(Map<String, dynamic> json) =>
      _$$UsageImplFromJson(json);

  /// The total number of tokens in the Response including input and output text and audio tokens.
  @override
  @JsonKey(name: 'total_tokens', includeIfNull: false)
  final int? totalTokens;

  /// The number of input tokens used in the Response, including text and audio tokens.
  @override
  @JsonKey(name: 'input_tokens', includeIfNull: false)
  final int? inputTokens;

  /// The number of output tokens sent in the Response, including text and audio tokens.
  @override
  @JsonKey(name: 'output_tokens', includeIfNull: false)
  final int? outputTokens;

  /// Details about the input tokens used in the Response.
  @override
  @JsonKey(name: 'input_token_details', includeIfNull: false)
  final UsageInputTokenDetails? inputTokenDetails;

  /// Details about the output tokens used in the Response.
  @override
  @JsonKey(name: 'output_token_details', includeIfNull: false)
  final UsageOutputTokenDetails? outputTokenDetails;

  @override
  String toString() {
    return 'Usage(totalTokens: $totalTokens, inputTokens: $inputTokens, outputTokens: $outputTokens, inputTokenDetails: $inputTokenDetails, outputTokenDetails: $outputTokenDetails)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$UsageImpl &&
            (identical(other.totalTokens, totalTokens) ||
                other.totalTokens == totalTokens) &&
            (identical(other.inputTokens, inputTokens) ||
                other.inputTokens == inputTokens) &&
            (identical(other.outputTokens, outputTokens) ||
                other.outputTokens == outputTokens) &&
            (identical(other.inputTokenDetails, inputTokenDetails) ||
                other.inputTokenDetails == inputTokenDetails) &&
            (identical(other.outputTokenDetails, outputTokenDetails) ||
                other.outputTokenDetails == outputTokenDetails));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, totalTokens, inputTokens,
      outputTokens, inputTokenDetails, outputTokenDetails);

  /// Create a copy of Usage
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$UsageImplCopyWith<_$UsageImpl> get copyWith =>
      __$$UsageImplCopyWithImpl<_$UsageImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$UsageImplToJson(
      this,
    );
  }
}

abstract class _Usage extends Usage {
  const factory _Usage(
      {@JsonKey(name: 'total_tokens', includeIfNull: false)
      final int? totalTokens,
      @JsonKey(name: 'input_tokens', includeIfNull: false)
      final int? inputTokens,
      @JsonKey(name: 'output_tokens', includeIfNull: false)
      final int? outputTokens,
      @JsonKey(name: 'input_token_details', includeIfNull: false)
      final UsageInputTokenDetails? inputTokenDetails,
      @JsonKey(name: 'output_token_details', includeIfNull: false)
      final UsageOutputTokenDetails? outputTokenDetails}) = _$UsageImpl;
  const _Usage._() : super._();

  factory _Usage.fromJson(Map<String, dynamic> json) = _$UsageImpl.fromJson;

  /// The total number of tokens in the Response including input and output text and audio tokens.
  @override
  @JsonKey(name: 'total_tokens', includeIfNull: false)
  int? get totalTokens;

  /// The number of input tokens used in the Response, including text and audio tokens.
  @override
  @JsonKey(name: 'input_tokens', includeIfNull: false)
  int? get inputTokens;

  /// The number of output tokens sent in the Response, including text and audio tokens.
  @override
  @JsonKey(name: 'output_tokens', includeIfNull: false)
  int? get outputTokens;

  /// Details about the input tokens used in the Response.
  @override
  @JsonKey(name: 'input_token_details', includeIfNull: false)
  UsageInputTokenDetails? get inputTokenDetails;

  /// Details about the output tokens used in the Response.
  @override
  @JsonKey(name: 'output_token_details', includeIfNull: false)
  UsageOutputTokenDetails? get outputTokenDetails;

  /// Create a copy of Usage
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$UsageImplCopyWith<_$UsageImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

UsageInputTokenDetails _$UsageInputTokenDetailsFromJson(
    Map<String, dynamic> json) {
  return _UsageInputTokenDetails.fromJson(json);
}

/// @nodoc
mixin _$UsageInputTokenDetails {
  /// The number of cached tokens used in the Response.
  @JsonKey(name: 'cached_tokens', includeIfNull: false)
  int? get cachedTokens => throw _privateConstructorUsedError;

  /// The number of text tokens used in the Response.
  @JsonKey(name: 'text_tokens', includeIfNull: false)
  int? get textTokens => throw _privateConstructorUsedError;

  /// The number of audio tokens used in the Response.
  @JsonKey(name: 'audio_tokens', includeIfNull: false)
  int? get audioTokens => throw _privateConstructorUsedError;

  /// Serializes this UsageInputTokenDetails to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of UsageInputTokenDetails
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $UsageInputTokenDetailsCopyWith<UsageInputTokenDetails> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $UsageInputTokenDetailsCopyWith<$Res> {
  factory $UsageInputTokenDetailsCopyWith(UsageInputTokenDetails value,
          $Res Function(UsageInputTokenDetails) then) =
      _$UsageInputTokenDetailsCopyWithImpl<$Res, UsageInputTokenDetails>;
  @useResult
  $Res call(
      {@JsonKey(name: 'cached_tokens', includeIfNull: false) int? cachedTokens,
      @JsonKey(name: 'text_tokens', includeIfNull: false) int? textTokens,
      @JsonKey(name: 'audio_tokens', includeIfNull: false) int? audioTokens});
}

/// @nodoc
class _$UsageInputTokenDetailsCopyWithImpl<$Res,
        $Val extends UsageInputTokenDetails>
    implements $UsageInputTokenDetailsCopyWith<$Res> {
  _$UsageInputTokenDetailsCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of UsageInputTokenDetails
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? cachedTokens = freezed,
    Object? textTokens = freezed,
    Object? audioTokens = freezed,
  }) {
    return _then(_value.copyWith(
      cachedTokens: freezed == cachedTokens
          ? _value.cachedTokens
          : cachedTokens // ignore: cast_nullable_to_non_nullable
              as int?,
      textTokens: freezed == textTokens
          ? _value.textTokens
          : textTokens // ignore: cast_nullable_to_non_nullable
              as int?,
      audioTokens: freezed == audioTokens
          ? _value.audioTokens
          : audioTokens // ignore: cast_nullable_to_non_nullable
              as int?,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$UsageInputTokenDetailsImplCopyWith<$Res>
    implements $UsageInputTokenDetailsCopyWith<$Res> {
  factory _$$UsageInputTokenDetailsImplCopyWith(
          _$UsageInputTokenDetailsImpl value,
          $Res Function(_$UsageInputTokenDetailsImpl) then) =
      __$$UsageInputTokenDetailsImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'cached_tokens', includeIfNull: false) int? cachedTokens,
      @JsonKey(name: 'text_tokens', includeIfNull: false) int? textTokens,
      @JsonKey(name: 'audio_tokens', includeIfNull: false) int? audioTokens});
}

/// @nodoc
class __$$UsageInputTokenDetailsImplCopyWithImpl<$Res>
    extends _$UsageInputTokenDetailsCopyWithImpl<$Res,
        _$UsageInputTokenDetailsImpl>
    implements _$$UsageInputTokenDetailsImplCopyWith<$Res> {
  __$$UsageInputTokenDetailsImplCopyWithImpl(
      _$UsageInputTokenDetailsImpl _value,
      $Res Function(_$UsageInputTokenDetailsImpl) _then)
      : super(_value, _then);

  /// Create a copy of UsageInputTokenDetails
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? cachedTokens = freezed,
    Object? textTokens = freezed,
    Object? audioTokens = freezed,
  }) {
    return _then(_$UsageInputTokenDetailsImpl(
      cachedTokens: freezed == cachedTokens
          ? _value.cachedTokens
          : cachedTokens // ignore: cast_nullable_to_non_nullable
              as int?,
      textTokens: freezed == textTokens
          ? _value.textTokens
          : textTokens // ignore: cast_nullable_to_non_nullable
              as int?,
      audioTokens: freezed == audioTokens
          ? _value.audioTokens
          : audioTokens // ignore: cast_nullable_to_non_nullable
              as int?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$UsageInputTokenDetailsImpl extends _UsageInputTokenDetails {
  const _$UsageInputTokenDetailsImpl(
      {@JsonKey(name: 'cached_tokens', includeIfNull: false) this.cachedTokens,
      @JsonKey(name: 'text_tokens', includeIfNull: false) this.textTokens,
      @JsonKey(name: 'audio_tokens', includeIfNull: false) this.audioTokens})
      : super._();

  factory _$UsageInputTokenDetailsImpl.fromJson(Map<String, dynamic> json) =>
      _$$UsageInputTokenDetailsImplFromJson(json);

  /// The number of cached tokens used in the Response.
  @override
  @JsonKey(name: 'cached_tokens', includeIfNull: false)
  final int? cachedTokens;

  /// The number of text tokens used in the Response.
  @override
  @JsonKey(name: 'text_tokens', includeIfNull: false)
  final int? textTokens;

  /// The number of audio tokens used in the Response.
  @override
  @JsonKey(name: 'audio_tokens', includeIfNull: false)
  final int? audioTokens;

  @override
  String toString() {
    return 'UsageInputTokenDetails(cachedTokens: $cachedTokens, textTokens: $textTokens, audioTokens: $audioTokens)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$UsageInputTokenDetailsImpl &&
            (identical(other.cachedTokens, cachedTokens) ||
                other.cachedTokens == cachedTokens) &&
            (identical(other.textTokens, textTokens) ||
                other.textTokens == textTokens) &&
            (identical(other.audioTokens, audioTokens) ||
                other.audioTokens == audioTokens));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, cachedTokens, textTokens, audioTokens);

  /// Create a copy of UsageInputTokenDetails
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$UsageInputTokenDetailsImplCopyWith<_$UsageInputTokenDetailsImpl>
      get copyWith => __$$UsageInputTokenDetailsImplCopyWithImpl<
          _$UsageInputTokenDetailsImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$UsageInputTokenDetailsImplToJson(
      this,
    );
  }
}

abstract class _UsageInputTokenDetails extends UsageInputTokenDetails {
  const factory _UsageInputTokenDetails(
      {@JsonKey(name: 'cached_tokens', includeIfNull: false)
      final int? cachedTokens,
      @JsonKey(name: 'text_tokens', includeIfNull: false) final int? textTokens,
      @JsonKey(name: 'audio_tokens', includeIfNull: false)
      final int? audioTokens}) = _$UsageInputTokenDetailsImpl;
  const _UsageInputTokenDetails._() : super._();

  factory _UsageInputTokenDetails.fromJson(Map<String, dynamic> json) =
      _$UsageInputTokenDetailsImpl.fromJson;

  /// The number of cached tokens used in the Response.
  @override
  @JsonKey(name: 'cached_tokens', includeIfNull: false)
  int? get cachedTokens;

  /// The number of text tokens used in the Response.
  @override
  @JsonKey(name: 'text_tokens', includeIfNull: false)
  int? get textTokens;

  /// The number of audio tokens used in the Response.
  @override
  @JsonKey(name: 'audio_tokens', includeIfNull: false)
  int? get audioTokens;

  /// Create a copy of UsageInputTokenDetails
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$UsageInputTokenDetailsImplCopyWith<_$UsageInputTokenDetailsImpl>
      get copyWith => throw _privateConstructorUsedError;
}

UsageOutputTokenDetails _$UsageOutputTokenDetailsFromJson(
    Map<String, dynamic> json) {
  return _UsageOutputTokenDetails.fromJson(json);
}

/// @nodoc
mixin _$UsageOutputTokenDetails {
  /// The number of text tokens used in the Response.
  @JsonKey(name: 'text_tokens', includeIfNull: false)
  int? get textTokens => throw _privateConstructorUsedError;

  /// The number of audio tokens used in the Response.
  @JsonKey(name: 'audio_tokens', includeIfNull: false)
  int? get audioTokens => throw _privateConstructorUsedError;

  /// Serializes this UsageOutputTokenDetails to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of UsageOutputTokenDetails
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $UsageOutputTokenDetailsCopyWith<UsageOutputTokenDetails> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $UsageOutputTokenDetailsCopyWith<$Res> {
  factory $UsageOutputTokenDetailsCopyWith(UsageOutputTokenDetails value,
          $Res Function(UsageOutputTokenDetails) then) =
      _$UsageOutputTokenDetailsCopyWithImpl<$Res, UsageOutputTokenDetails>;
  @useResult
  $Res call(
      {@JsonKey(name: 'text_tokens', includeIfNull: false) int? textTokens,
      @JsonKey(name: 'audio_tokens', includeIfNull: false) int? audioTokens});
}

/// @nodoc
class _$UsageOutputTokenDetailsCopyWithImpl<$Res,
        $Val extends UsageOutputTokenDetails>
    implements $UsageOutputTokenDetailsCopyWith<$Res> {
  _$UsageOutputTokenDetailsCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of UsageOutputTokenDetails
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? textTokens = freezed,
    Object? audioTokens = freezed,
  }) {
    return _then(_value.copyWith(
      textTokens: freezed == textTokens
          ? _value.textTokens
          : textTokens // ignore: cast_nullable_to_non_nullable
              as int?,
      audioTokens: freezed == audioTokens
          ? _value.audioTokens
          : audioTokens // ignore: cast_nullable_to_non_nullable
              as int?,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$UsageOutputTokenDetailsImplCopyWith<$Res>
    implements $UsageOutputTokenDetailsCopyWith<$Res> {
  factory _$$UsageOutputTokenDetailsImplCopyWith(
          _$UsageOutputTokenDetailsImpl value,
          $Res Function(_$UsageOutputTokenDetailsImpl) then) =
      __$$UsageOutputTokenDetailsImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'text_tokens', includeIfNull: false) int? textTokens,
      @JsonKey(name: 'audio_tokens', includeIfNull: false) int? audioTokens});
}

/// @nodoc
class __$$UsageOutputTokenDetailsImplCopyWithImpl<$Res>
    extends _$UsageOutputTokenDetailsCopyWithImpl<$Res,
        _$UsageOutputTokenDetailsImpl>
    implements _$$UsageOutputTokenDetailsImplCopyWith<$Res> {
  __$$UsageOutputTokenDetailsImplCopyWithImpl(
      _$UsageOutputTokenDetailsImpl _value,
      $Res Function(_$UsageOutputTokenDetailsImpl) _then)
      : super(_value, _then);

  /// Create a copy of UsageOutputTokenDetails
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? textTokens = freezed,
    Object? audioTokens = freezed,
  }) {
    return _then(_$UsageOutputTokenDetailsImpl(
      textTokens: freezed == textTokens
          ? _value.textTokens
          : textTokens // ignore: cast_nullable_to_non_nullable
              as int?,
      audioTokens: freezed == audioTokens
          ? _value.audioTokens
          : audioTokens // ignore: cast_nullable_to_non_nullable
              as int?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$UsageOutputTokenDetailsImpl extends _UsageOutputTokenDetails {
  const _$UsageOutputTokenDetailsImpl(
      {@JsonKey(name: 'text_tokens', includeIfNull: false) this.textTokens,
      @JsonKey(name: 'audio_tokens', includeIfNull: false) this.audioTokens})
      : super._();

  factory _$UsageOutputTokenDetailsImpl.fromJson(Map<String, dynamic> json) =>
      _$$UsageOutputTokenDetailsImplFromJson(json);

  /// The number of text tokens used in the Response.
  @override
  @JsonKey(name: 'text_tokens', includeIfNull: false)
  final int? textTokens;

  /// The number of audio tokens used in the Response.
  @override
  @JsonKey(name: 'audio_tokens', includeIfNull: false)
  final int? audioTokens;

  @override
  String toString() {
    return 'UsageOutputTokenDetails(textTokens: $textTokens, audioTokens: $audioTokens)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$UsageOutputTokenDetailsImpl &&
            (identical(other.textTokens, textTokens) ||
                other.textTokens == textTokens) &&
            (identical(other.audioTokens, audioTokens) ||
                other.audioTokens == audioTokens));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, textTokens, audioTokens);

  /// Create a copy of UsageOutputTokenDetails
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$UsageOutputTokenDetailsImplCopyWith<_$UsageOutputTokenDetailsImpl>
      get copyWith => __$$UsageOutputTokenDetailsImplCopyWithImpl<
          _$UsageOutputTokenDetailsImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$UsageOutputTokenDetailsImplToJson(
      this,
    );
  }
}

abstract class _UsageOutputTokenDetails extends UsageOutputTokenDetails {
  const factory _UsageOutputTokenDetails(
      {@JsonKey(name: 'text_tokens', includeIfNull: false)
      final int? textTokens,
      @JsonKey(name: 'audio_tokens', includeIfNull: false)
      final int? audioTokens}) = _$UsageOutputTokenDetailsImpl;
  const _UsageOutputTokenDetails._() : super._();

  factory _UsageOutputTokenDetails.fromJson(Map<String, dynamic> json) =
      _$UsageOutputTokenDetailsImpl.fromJson;

  /// The number of text tokens used in the Response.
  @override
  @JsonKey(name: 'text_tokens', includeIfNull: false)
  int? get textTokens;

  /// The number of audio tokens used in the Response.
  @override
  @JsonKey(name: 'audio_tokens', includeIfNull: false)
  int? get audioTokens;

  /// Create a copy of UsageOutputTokenDetails
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$UsageOutputTokenDetailsImplCopyWith<_$UsageOutputTokenDetailsImpl>
      get copyWith => throw _privateConstructorUsedError;
}

Session _$SessionFromJson(Map<String, dynamic> json) {
  return _Session.fromJson(json);
}

/// @nodoc
mixin _$Session {
  /// The unique ID of the session.
  @JsonKey(includeIfNull: false)
  String? get id => throw _privateConstructorUsedError;

  /// The object type, must be "realtime.session".
  ObjectType get object => throw _privateConstructorUsedError;

  /// The default model used for this session.
  @JsonKey(includeIfNull: false)
  String? get model => throw _privateConstructorUsedError;

  /// The time at which the session expires.
  @JsonKey(name: 'expires_at', includeIfNull: false)
  int? get expiresAt => throw _privateConstructorUsedError;

  /// The set of modalities the model can respond with.
  @JsonKey(includeIfNull: false)
  List<Modality>? get modalities => throw _privateConstructorUsedError;

  /// The default system instructions.
  @JsonKey(includeIfNull: false)
  String? get instructions => throw _privateConstructorUsedError;

  /// The voice the model uses to respond - one of `alloy`, `echo`, or `shimmer`.
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  Voice? get voice => throw _privateConstructorUsedError;

  /// The format of input audio.
  @JsonKey(
      name: 'input_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  AudioFormat? get inputAudioFormat => throw _privateConstructorUsedError;

  /// The format of output audio.
  @JsonKey(
      name: 'output_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  AudioFormat? get outputAudioFormat => throw _privateConstructorUsedError;

  /// Configuration for input audio transcription.
  @JsonKey(name: 'input_audio_transcription', includeIfNull: false)
  InputAudioTranscriptionConfig? get inputAudioTranscription =>
      throw _privateConstructorUsedError;

  /// Configuration for turn detection. Can be set to `null` to turn off. Server
  /// VAD means that the model will detect the start and end of speech based on
  /// audio volume and respond at the end of user speech.
  @JsonKey(name: 'turn_detection', includeIfNull: false)
  TurnDetection? get turnDetection => throw _privateConstructorUsedError;

  /// Tools (functions) available to the model.
  @JsonKey(includeIfNull: false)
  List<ToolDefinition>? get tools => throw _privateConstructorUsedError;

  /// How the model chooses tools.
  @_SessionToolChoiceConverter()
  @JsonKey(name: 'tool_choice', includeIfNull: false)
  SessionToolChoice? get toolChoice => throw _privateConstructorUsedError;

  /// Sampling temperature.
  @JsonKey(includeIfNull: false)
  double? get temperature => throw _privateConstructorUsedError;

  /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf".
  @_SessionMaxResponseOutputTokensConverter()
  @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
  SessionMaxResponseOutputTokens? get maxResponseOutputTokens =>
      throw _privateConstructorUsedError;

  /// Serializes this Session to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of Session
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $SessionCopyWith<Session> get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $SessionCopyWith<$Res> {
  factory $SessionCopyWith(Session value, $Res Function(Session) then) =
      _$SessionCopyWithImpl<$Res, Session>;
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) String? id,
      ObjectType object,
      @JsonKey(includeIfNull: false) String? model,
      @JsonKey(name: 'expires_at', includeIfNull: false) int? expiresAt,
      @JsonKey(includeIfNull: false) List<Modality>? modalities,
      @JsonKey(includeIfNull: false) String? instructions,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      Voice? voice,
      @JsonKey(
          name: 'input_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      AudioFormat? inputAudioFormat,
      @JsonKey(
          name: 'output_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      AudioFormat? outputAudioFormat,
      @JsonKey(name: 'input_audio_transcription', includeIfNull: false)
      InputAudioTranscriptionConfig? inputAudioTranscription,
      @JsonKey(name: 'turn_detection', includeIfNull: false)
      TurnDetection? turnDetection,
      @JsonKey(includeIfNull: false) List<ToolDefinition>? tools,
      @_SessionToolChoiceConverter()
      @JsonKey(name: 'tool_choice', includeIfNull: false)
      SessionToolChoice? toolChoice,
      @JsonKey(includeIfNull: false) double? temperature,
      @_SessionMaxResponseOutputTokensConverter()
      @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
      SessionMaxResponseOutputTokens? maxResponseOutputTokens});

  $InputAudioTranscriptionConfigCopyWith<$Res>? get inputAudioTranscription;
  $TurnDetectionCopyWith<$Res>? get turnDetection;
  $SessionToolChoiceCopyWith<$Res>? get toolChoice;
  $SessionMaxResponseOutputTokensCopyWith<$Res>? get maxResponseOutputTokens;
}

/// @nodoc
class _$SessionCopyWithImpl<$Res, $Val extends Session>
    implements $SessionCopyWith<$Res> {
  _$SessionCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of Session
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? id = freezed,
    Object? object = null,
    Object? model = freezed,
    Object? expiresAt = freezed,
    Object? modalities = freezed,
    Object? instructions = freezed,
    Object? voice = freezed,
    Object? inputAudioFormat = freezed,
    Object? outputAudioFormat = freezed,
    Object? inputAudioTranscription = freezed,
    Object? turnDetection = freezed,
    Object? tools = freezed,
    Object? toolChoice = freezed,
    Object? temperature = freezed,
    Object? maxResponseOutputTokens = freezed,
  }) {
    return _then(_value.copyWith(
      id: freezed == id
          ? _value.id
          : id // ignore: cast_nullable_to_non_nullable
              as String?,
      object: null == object
          ? _value.object
          : object // ignore: cast_nullable_to_non_nullable
              as ObjectType,
      model: freezed == model
          ? _value.model
          : model // ignore: cast_nullable_to_non_nullable
              as String?,
      expiresAt: freezed == expiresAt
          ? _value.expiresAt
          : expiresAt // ignore: cast_nullable_to_non_nullable
              as int?,
      modalities: freezed == modalities
          ? _value.modalities
          : modalities // ignore: cast_nullable_to_non_nullable
              as List<Modality>?,
      instructions: freezed == instructions
          ? _value.instructions
          : instructions // ignore: cast_nullable_to_non_nullable
              as String?,
      voice: freezed == voice
          ? _value.voice
          : voice // ignore: cast_nullable_to_non_nullable
              as Voice?,
      inputAudioFormat: freezed == inputAudioFormat
          ? _value.inputAudioFormat
          : inputAudioFormat // ignore: cast_nullable_to_non_nullable
              as AudioFormat?,
      outputAudioFormat: freezed == outputAudioFormat
          ? _value.outputAudioFormat
          : outputAudioFormat // ignore: cast_nullable_to_non_nullable
              as AudioFormat?,
      inputAudioTranscription: freezed == inputAudioTranscription
          ? _value.inputAudioTranscription
          : inputAudioTranscription // ignore: cast_nullable_to_non_nullable
              as InputAudioTranscriptionConfig?,
      turnDetection: freezed == turnDetection
          ? _value.turnDetection
          : turnDetection // ignore: cast_nullable_to_non_nullable
              as TurnDetection?,
      tools: freezed == tools
          ? _value.tools
          : tools // ignore: cast_nullable_to_non_nullable
              as List<ToolDefinition>?,
      toolChoice: freezed == toolChoice
          ? _value.toolChoice
          : toolChoice // ignore: cast_nullable_to_non_nullable
              as SessionToolChoice?,
      temperature: freezed == temperature
          ? _value.temperature
          : temperature // ignore: cast_nullable_to_non_nullable
              as double?,
      maxResponseOutputTokens: freezed == maxResponseOutputTokens
          ? _value.maxResponseOutputTokens
          : maxResponseOutputTokens // ignore: cast_nullable_to_non_nullable
              as SessionMaxResponseOutputTokens?,
    ) as $Val);
  }

  /// Create a copy of Session
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $InputAudioTranscriptionConfigCopyWith<$Res>? get inputAudioTranscription {
    if (_value.inputAudioTranscription == null) {
      return null;
    }

    return $InputAudioTranscriptionConfigCopyWith<$Res>(
        _value.inputAudioTranscription!, (value) {
      return _then(_value.copyWith(inputAudioTranscription: value) as $Val);
    });
  }

  /// Create a copy of Session
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $TurnDetectionCopyWith<$Res>? get turnDetection {
    if (_value.turnDetection == null) {
      return null;
    }

    return $TurnDetectionCopyWith<$Res>(_value.turnDetection!, (value) {
      return _then(_value.copyWith(turnDetection: value) as $Val);
    });
  }

  /// Create a copy of Session
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $SessionToolChoiceCopyWith<$Res>? get toolChoice {
    if (_value.toolChoice == null) {
      return null;
    }

    return $SessionToolChoiceCopyWith<$Res>(_value.toolChoice!, (value) {
      return _then(_value.copyWith(toolChoice: value) as $Val);
    });
  }

  /// Create a copy of Session
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $SessionMaxResponseOutputTokensCopyWith<$Res>? get maxResponseOutputTokens {
    if (_value.maxResponseOutputTokens == null) {
      return null;
    }

    return $SessionMaxResponseOutputTokensCopyWith<$Res>(
        _value.maxResponseOutputTokens!, (value) {
      return _then(_value.copyWith(maxResponseOutputTokens: value) as $Val);
    });
  }
}

/// @nodoc
abstract class _$$SessionImplCopyWith<$Res> implements $SessionCopyWith<$Res> {
  factory _$$SessionImplCopyWith(
          _$SessionImpl value, $Res Function(_$SessionImpl) then) =
      __$$SessionImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) String? id,
      ObjectType object,
      @JsonKey(includeIfNull: false) String? model,
      @JsonKey(name: 'expires_at', includeIfNull: false) int? expiresAt,
      @JsonKey(includeIfNull: false) List<Modality>? modalities,
      @JsonKey(includeIfNull: false) String? instructions,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      Voice? voice,
      @JsonKey(
          name: 'input_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      AudioFormat? inputAudioFormat,
      @JsonKey(
          name: 'output_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      AudioFormat? outputAudioFormat,
      @JsonKey(name: 'input_audio_transcription', includeIfNull: false)
      InputAudioTranscriptionConfig? inputAudioTranscription,
      @JsonKey(name: 'turn_detection', includeIfNull: false)
      TurnDetection? turnDetection,
      @JsonKey(includeIfNull: false) List<ToolDefinition>? tools,
      @_SessionToolChoiceConverter()
      @JsonKey(name: 'tool_choice', includeIfNull: false)
      SessionToolChoice? toolChoice,
      @JsonKey(includeIfNull: false) double? temperature,
      @_SessionMaxResponseOutputTokensConverter()
      @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
      SessionMaxResponseOutputTokens? maxResponseOutputTokens});

  @override
  $InputAudioTranscriptionConfigCopyWith<$Res>? get inputAudioTranscription;
  @override
  $TurnDetectionCopyWith<$Res>? get turnDetection;
  @override
  $SessionToolChoiceCopyWith<$Res>? get toolChoice;
  @override
  $SessionMaxResponseOutputTokensCopyWith<$Res>? get maxResponseOutputTokens;
}

/// @nodoc
class __$$SessionImplCopyWithImpl<$Res>
    extends _$SessionCopyWithImpl<$Res, _$SessionImpl>
    implements _$$SessionImplCopyWith<$Res> {
  __$$SessionImplCopyWithImpl(
      _$SessionImpl _value, $Res Function(_$SessionImpl) _then)
      : super(_value, _then);

  /// Create a copy of Session
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? id = freezed,
    Object? object = null,
    Object? model = freezed,
    Object? expiresAt = freezed,
    Object? modalities = freezed,
    Object? instructions = freezed,
    Object? voice = freezed,
    Object? inputAudioFormat = freezed,
    Object? outputAudioFormat = freezed,
    Object? inputAudioTranscription = freezed,
    Object? turnDetection = freezed,
    Object? tools = freezed,
    Object? toolChoice = freezed,
    Object? temperature = freezed,
    Object? maxResponseOutputTokens = freezed,
  }) {
    return _then(_$SessionImpl(
      id: freezed == id
          ? _value.id
          : id // ignore: cast_nullable_to_non_nullable
              as String?,
      object: null == object
          ? _value.object
          : object // ignore: cast_nullable_to_non_nullable
              as ObjectType,
      model: freezed == model
          ? _value.model
          : model // ignore: cast_nullable_to_non_nullable
              as String?,
      expiresAt: freezed == expiresAt
          ? _value.expiresAt
          : expiresAt // ignore: cast_nullable_to_non_nullable
              as int?,
      modalities: freezed == modalities
          ? _value._modalities
          : modalities // ignore: cast_nullable_to_non_nullable
              as List<Modality>?,
      instructions: freezed == instructions
          ? _value.instructions
          : instructions // ignore: cast_nullable_to_non_nullable
              as String?,
      voice: freezed == voice
          ? _value.voice
          : voice // ignore: cast_nullable_to_non_nullable
              as Voice?,
      inputAudioFormat: freezed == inputAudioFormat
          ? _value.inputAudioFormat
          : inputAudioFormat // ignore: cast_nullable_to_non_nullable
              as AudioFormat?,
      outputAudioFormat: freezed == outputAudioFormat
          ? _value.outputAudioFormat
          : outputAudioFormat // ignore: cast_nullable_to_non_nullable
              as AudioFormat?,
      inputAudioTranscription: freezed == inputAudioTranscription
          ? _value.inputAudioTranscription
          : inputAudioTranscription // ignore: cast_nullable_to_non_nullable
              as InputAudioTranscriptionConfig?,
      turnDetection: freezed == turnDetection
          ? _value.turnDetection
          : turnDetection // ignore: cast_nullable_to_non_nullable
              as TurnDetection?,
      tools: freezed == tools
          ? _value._tools
          : tools // ignore: cast_nullable_to_non_nullable
              as List<ToolDefinition>?,
      toolChoice: freezed == toolChoice
          ? _value.toolChoice
          : toolChoice // ignore: cast_nullable_to_non_nullable
              as SessionToolChoice?,
      temperature: freezed == temperature
          ? _value.temperature
          : temperature // ignore: cast_nullable_to_non_nullable
              as double?,
      maxResponseOutputTokens: freezed == maxResponseOutputTokens
          ? _value.maxResponseOutputTokens
          : maxResponseOutputTokens // ignore: cast_nullable_to_non_nullable
              as SessionMaxResponseOutputTokens?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$SessionImpl extends _Session {
  const _$SessionImpl(
      {@JsonKey(includeIfNull: false) this.id,
      this.object = ObjectType.realtimeSession,
      @JsonKey(includeIfNull: false) this.model,
      @JsonKey(name: 'expires_at', includeIfNull: false) this.expiresAt,
      @JsonKey(includeIfNull: false) final List<Modality>? modalities,
      @JsonKey(includeIfNull: false) this.instructions,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.voice,
      @JsonKey(
          name: 'input_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.inputAudioFormat,
      @JsonKey(
          name: 'output_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.outputAudioFormat,
      @JsonKey(name: 'input_audio_transcription', includeIfNull: false)
      this.inputAudioTranscription,
      @JsonKey(name: 'turn_detection', includeIfNull: false) this.turnDetection,
      @JsonKey(includeIfNull: false) final List<ToolDefinition>? tools,
      @_SessionToolChoiceConverter()
      @JsonKey(name: 'tool_choice', includeIfNull: false)
      this.toolChoice,
      @JsonKey(includeIfNull: false) this.temperature,
      @_SessionMaxResponseOutputTokensConverter()
      @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
      this.maxResponseOutputTokens})
      : _modalities = modalities,
        _tools = tools,
        super._();

  factory _$SessionImpl.fromJson(Map<String, dynamic> json) =>
      _$$SessionImplFromJson(json);

  /// The unique ID of the session.
  @override
  @JsonKey(includeIfNull: false)
  final String? id;

  /// The object type, must be "realtime.session".
  @override
  @JsonKey()
  final ObjectType object;

  /// The default model used for this session.
  @override
  @JsonKey(includeIfNull: false)
  final String? model;

  /// The time at which the session expires.
  @override
  @JsonKey(name: 'expires_at', includeIfNull: false)
  final int? expiresAt;

  /// The set of modalities the model can respond with.
  final List<Modality>? _modalities;

  /// The set of modalities the model can respond with.
  @override
  @JsonKey(includeIfNull: false)
  List<Modality>? get modalities {
    final value = _modalities;
    if (value == null) return null;
    if (_modalities is EqualUnmodifiableListView) return _modalities;
    // ignore: implicit_dynamic_type
    return EqualUnmodifiableListView(value);
  }

  /// The default system instructions.
  @override
  @JsonKey(includeIfNull: false)
  final String? instructions;

  /// The voice the model uses to respond - one of `alloy`, `echo`, or `shimmer`.
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final Voice? voice;

  /// The format of input audio.
  @override
  @JsonKey(
      name: 'input_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final AudioFormat? inputAudioFormat;

  /// The format of output audio.
  @override
  @JsonKey(
      name: 'output_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final AudioFormat? outputAudioFormat;

  /// Configuration for input audio transcription.
  @override
  @JsonKey(name: 'input_audio_transcription', includeIfNull: false)
  final InputAudioTranscriptionConfig? inputAudioTranscription;

  /// Configuration for turn detection. Can be set to `null` to turn off. Server
  /// VAD means that the model will detect the start and end of speech based on
  /// audio volume and respond at the end of user speech.
  @override
  @JsonKey(name: 'turn_detection', includeIfNull: false)
  final TurnDetection? turnDetection;

  /// Tools (functions) available to the model.
  final List<ToolDefinition>? _tools;

  /// Tools (functions) available to the model.
  @override
  @JsonKey(includeIfNull: false)
  List<ToolDefinition>? get tools {
    final value = _tools;
    if (value == null) return null;
    if (_tools is EqualUnmodifiableListView) return _tools;
    // ignore: implicit_dynamic_type
    return EqualUnmodifiableListView(value);
  }

  /// How the model chooses tools.
  @override
  @_SessionToolChoiceConverter()
  @JsonKey(name: 'tool_choice', includeIfNull: false)
  final SessionToolChoice? toolChoice;

  /// Sampling temperature.
  @override
  @JsonKey(includeIfNull: false)
  final double? temperature;

  /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf".
  @override
  @_SessionMaxResponseOutputTokensConverter()
  @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
  final SessionMaxResponseOutputTokens? maxResponseOutputTokens;

  @override
  String toString() {
    return 'Session(id: $id, object: $object, model: $model, expiresAt: $expiresAt, modalities: $modalities, instructions: $instructions, voice: $voice, inputAudioFormat: $inputAudioFormat, outputAudioFormat: $outputAudioFormat, inputAudioTranscription: $inputAudioTranscription, turnDetection: $turnDetection, tools: $tools, toolChoice: $toolChoice, temperature: $temperature, maxResponseOutputTokens: $maxResponseOutputTokens)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$SessionImpl &&
            (identical(other.id, id) || other.id == id) &&
            (identical(other.object, object) || other.object == object) &&
            (identical(other.model, model) || other.model == model) &&
            (identical(other.expiresAt, expiresAt) ||
                other.expiresAt == expiresAt) &&
            const DeepCollectionEquality()
                .equals(other._modalities, _modalities) &&
            (identical(other.instructions, instructions) ||
                other.instructions == instructions) &&
            (identical(other.voice, voice) || other.voice == voice) &&
            (identical(other.inputAudioFormat, inputAudioFormat) ||
                other.inputAudioFormat == inputAudioFormat) &&
            (identical(other.outputAudioFormat, outputAudioFormat) ||
                other.outputAudioFormat == outputAudioFormat) &&
            (identical(
                    other.inputAudioTranscription, inputAudioTranscription) ||
                other.inputAudioTranscription == inputAudioTranscription) &&
            (identical(other.turnDetection, turnDetection) ||
                other.turnDetection == turnDetection) &&
            const DeepCollectionEquality().equals(other._tools, _tools) &&
            (identical(other.toolChoice, toolChoice) ||
                other.toolChoice == toolChoice) &&
            (identical(other.temperature, temperature) ||
                other.temperature == temperature) &&
            (identical(
                    other.maxResponseOutputTokens, maxResponseOutputTokens) ||
                other.maxResponseOutputTokens == maxResponseOutputTokens));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(
      runtimeType,
      id,
      object,
      model,
      expiresAt,
      const DeepCollectionEquality().hash(_modalities),
      instructions,
      voice,
      inputAudioFormat,
      outputAudioFormat,
      inputAudioTranscription,
      turnDetection,
      const DeepCollectionEquality().hash(_tools),
      toolChoice,
      temperature,
      maxResponseOutputTokens);

  /// Create a copy of Session
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$SessionImplCopyWith<_$SessionImpl> get copyWith =>
      __$$SessionImplCopyWithImpl<_$SessionImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$SessionImplToJson(
      this,
    );
  }
}

abstract class _Session extends Session {
  const factory _Session(
      {@JsonKey(includeIfNull: false) final String? id,
      final ObjectType object,
      @JsonKey(includeIfNull: false) final String? model,
      @JsonKey(name: 'expires_at', includeIfNull: false) final int? expiresAt,
      @JsonKey(includeIfNull: false) final List<Modality>? modalities,
      @JsonKey(includeIfNull: false) final String? instructions,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      final Voice? voice,
      @JsonKey(
          name: 'input_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      final AudioFormat? inputAudioFormat,
      @JsonKey(
          name: 'output_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      final AudioFormat? outputAudioFormat,
      @JsonKey(name: 'input_audio_transcription', includeIfNull: false)
      final InputAudioTranscriptionConfig? inputAudioTranscription,
      @JsonKey(name: 'turn_detection', includeIfNull: false)
      final TurnDetection? turnDetection,
      @JsonKey(includeIfNull: false) final List<ToolDefinition>? tools,
      @_SessionToolChoiceConverter()
      @JsonKey(name: 'tool_choice', includeIfNull: false)
      final SessionToolChoice? toolChoice,
      @JsonKey(includeIfNull: false) final double? temperature,
      @_SessionMaxResponseOutputTokensConverter()
      @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
      final SessionMaxResponseOutputTokens?
          maxResponseOutputTokens}) = _$SessionImpl;
  const _Session._() : super._();

  factory _Session.fromJson(Map<String, dynamic> json) = _$SessionImpl.fromJson;

  /// The unique ID of the session.
  @override
  @JsonKey(includeIfNull: false)
  String? get id;

  /// The object type, must be "realtime.session".
  @override
  ObjectType get object;

  /// The default model used for this session.
  @override
  @JsonKey(includeIfNull: false)
  String? get model;

  /// The time at which the session expires.
  @override
  @JsonKey(name: 'expires_at', includeIfNull: false)
  int? get expiresAt;

  /// The set of modalities the model can respond with.
  @override
  @JsonKey(includeIfNull: false)
  List<Modality>? get modalities;

  /// The default system instructions.
  @override
  @JsonKey(includeIfNull: false)
  String? get instructions;

  /// The voice the model uses to respond - one of `alloy`, `echo`, or `shimmer`.
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  Voice? get voice;

  /// The format of input audio.
  @override
  @JsonKey(
      name: 'input_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  AudioFormat? get inputAudioFormat;

  /// The format of output audio.
  @override
  @JsonKey(
      name: 'output_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  AudioFormat? get outputAudioFormat;

  /// Configuration for input audio transcription.
  @override
  @JsonKey(name: 'input_audio_transcription', includeIfNull: false)
  InputAudioTranscriptionConfig? get inputAudioTranscription;

  /// Configuration for turn detection. Can be set to `null` to turn off. Server
  /// VAD means that the model will detect the start and end of speech based on
  /// audio volume and respond at the end of user speech.
  @override
  @JsonKey(name: 'turn_detection', includeIfNull: false)
  TurnDetection? get turnDetection;

  /// Tools (functions) available to the model.
  @override
  @JsonKey(includeIfNull: false)
  List<ToolDefinition>? get tools;

  /// How the model chooses tools.
  @override
  @_SessionToolChoiceConverter()
  @JsonKey(name: 'tool_choice', includeIfNull: false)
  SessionToolChoice? get toolChoice;

  /// Sampling temperature.
  @override
  @JsonKey(includeIfNull: false)
  double? get temperature;

  /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf".
  @override
  @_SessionMaxResponseOutputTokensConverter()
  @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
  SessionMaxResponseOutputTokens? get maxResponseOutputTokens;

  /// Create a copy of Session
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$SessionImplCopyWith<_$SessionImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

SessionToolChoice _$SessionToolChoiceFromJson(Map<String, dynamic> json) {
  switch (json['runtimeType']) {
    case 'mode':
      return SessionToolChoiceEnumeration.fromJson(json);
    case 'toolChoiceForced':
      return SessionToolChoiceToolChoiceForced.fromJson(json);

    default:
      throw CheckedFromJsonException(json, 'runtimeType', 'SessionToolChoice',
          'Invalid union type "${json['runtimeType']}"!');
  }
}

/// @nodoc
mixin _$SessionToolChoice {
  Object get value => throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(SessionToolChoiceMode value) mode,
    required TResult Function(ToolChoiceForced value) toolChoiceForced,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(SessionToolChoiceMode value)? mode,
    TResult? Function(ToolChoiceForced value)? toolChoiceForced,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(SessionToolChoiceMode value)? mode,
    TResult Function(ToolChoiceForced value)? toolChoiceForced,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(SessionToolChoiceEnumeration value) mode,
    required TResult Function(SessionToolChoiceToolChoiceForced value)
        toolChoiceForced,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(SessionToolChoiceEnumeration value)? mode,
    TResult? Function(SessionToolChoiceToolChoiceForced value)?
        toolChoiceForced,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(SessionToolChoiceEnumeration value)? mode,
    TResult Function(SessionToolChoiceToolChoiceForced value)? toolChoiceForced,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;

  /// Serializes this SessionToolChoice to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $SessionToolChoiceCopyWith<$Res> {
  factory $SessionToolChoiceCopyWith(
          SessionToolChoice value, $Res Function(SessionToolChoice) then) =
      _$SessionToolChoiceCopyWithImpl<$Res, SessionToolChoice>;
}

/// @nodoc
class _$SessionToolChoiceCopyWithImpl<$Res, $Val extends SessionToolChoice>
    implements $SessionToolChoiceCopyWith<$Res> {
  _$SessionToolChoiceCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of SessionToolChoice
  /// with the given fields replaced by the non-null parameter values.
}

/// @nodoc
abstract class _$$SessionToolChoiceEnumerationImplCopyWith<$Res> {
  factory _$$SessionToolChoiceEnumerationImplCopyWith(
          _$SessionToolChoiceEnumerationImpl value,
          $Res Function(_$SessionToolChoiceEnumerationImpl) then) =
      __$$SessionToolChoiceEnumerationImplCopyWithImpl<$Res>;
  @useResult
  $Res call({SessionToolChoiceMode value});
}

/// @nodoc
class __$$SessionToolChoiceEnumerationImplCopyWithImpl<$Res>
    extends _$SessionToolChoiceCopyWithImpl<$Res,
        _$SessionToolChoiceEnumerationImpl>
    implements _$$SessionToolChoiceEnumerationImplCopyWith<$Res> {
  __$$SessionToolChoiceEnumerationImplCopyWithImpl(
      _$SessionToolChoiceEnumerationImpl _value,
      $Res Function(_$SessionToolChoiceEnumerationImpl) _then)
      : super(_value, _then);

  /// Create a copy of SessionToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? value = null,
  }) {
    return _then(_$SessionToolChoiceEnumerationImpl(
      null == value
          ? _value.value
          : value // ignore: cast_nullable_to_non_nullable
              as SessionToolChoiceMode,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$SessionToolChoiceEnumerationImpl extends SessionToolChoiceEnumeration {
  const _$SessionToolChoiceEnumerationImpl(this.value, {final String? $type})
      : $type = $type ?? 'mode',
        super._();

  factory _$SessionToolChoiceEnumerationImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$SessionToolChoiceEnumerationImplFromJson(json);

  @override
  final SessionToolChoiceMode value;

  @JsonKey(name: 'runtimeType')
  final String $type;

  @override
  String toString() {
    return 'SessionToolChoice.mode(value: $value)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$SessionToolChoiceEnumerationImpl &&
            (identical(other.value, value) || other.value == value));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, value);

  /// Create a copy of SessionToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$SessionToolChoiceEnumerationImplCopyWith<
          _$SessionToolChoiceEnumerationImpl>
      get copyWith => __$$SessionToolChoiceEnumerationImplCopyWithImpl<
          _$SessionToolChoiceEnumerationImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(SessionToolChoiceMode value) mode,
    required TResult Function(ToolChoiceForced value) toolChoiceForced,
  }) {
    return mode(value);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(SessionToolChoiceMode value)? mode,
    TResult? Function(ToolChoiceForced value)? toolChoiceForced,
  }) {
    return mode?.call(value);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(SessionToolChoiceMode value)? mode,
    TResult Function(ToolChoiceForced value)? toolChoiceForced,
    required TResult orElse(),
  }) {
    if (mode != null) {
      return mode(value);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(SessionToolChoiceEnumeration value) mode,
    required TResult Function(SessionToolChoiceToolChoiceForced value)
        toolChoiceForced,
  }) {
    return mode(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(SessionToolChoiceEnumeration value)? mode,
    TResult? Function(SessionToolChoiceToolChoiceForced value)?
        toolChoiceForced,
  }) {
    return mode?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(SessionToolChoiceEnumeration value)? mode,
    TResult Function(SessionToolChoiceToolChoiceForced value)? toolChoiceForced,
    required TResult orElse(),
  }) {
    if (mode != null) {
      return mode(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$SessionToolChoiceEnumerationImplToJson(
      this,
    );
  }
}

abstract class SessionToolChoiceEnumeration extends SessionToolChoice {
  const factory SessionToolChoiceEnumeration(
      final SessionToolChoiceMode value) = _$SessionToolChoiceEnumerationImpl;
  const SessionToolChoiceEnumeration._() : super._();

  factory SessionToolChoiceEnumeration.fromJson(Map<String, dynamic> json) =
      _$SessionToolChoiceEnumerationImpl.fromJson;

  @override
  SessionToolChoiceMode get value;

  /// Create a copy of SessionToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$SessionToolChoiceEnumerationImplCopyWith<
          _$SessionToolChoiceEnumerationImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$SessionToolChoiceToolChoiceForcedImplCopyWith<$Res> {
  factory _$$SessionToolChoiceToolChoiceForcedImplCopyWith(
          _$SessionToolChoiceToolChoiceForcedImpl value,
          $Res Function(_$SessionToolChoiceToolChoiceForcedImpl) then) =
      __$$SessionToolChoiceToolChoiceForcedImplCopyWithImpl<$Res>;
  @useResult
  $Res call({ToolChoiceForced value});

  $ToolChoiceForcedCopyWith<$Res> get value;
}

/// @nodoc
class __$$SessionToolChoiceToolChoiceForcedImplCopyWithImpl<$Res>
    extends _$SessionToolChoiceCopyWithImpl<$Res,
        _$SessionToolChoiceToolChoiceForcedImpl>
    implements _$$SessionToolChoiceToolChoiceForcedImplCopyWith<$Res> {
  __$$SessionToolChoiceToolChoiceForcedImplCopyWithImpl(
      _$SessionToolChoiceToolChoiceForcedImpl _value,
      $Res Function(_$SessionToolChoiceToolChoiceForcedImpl) _then)
      : super(_value, _then);

  /// Create a copy of SessionToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? value = null,
  }) {
    return _then(_$SessionToolChoiceToolChoiceForcedImpl(
      null == value
          ? _value.value
          : value // ignore: cast_nullable_to_non_nullable
              as ToolChoiceForced,
    ));
  }

  /// Create a copy of SessionToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ToolChoiceForcedCopyWith<$Res> get value {
    return $ToolChoiceForcedCopyWith<$Res>(_value.value, (value) {
      return _then(_value.copyWith(value: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$SessionToolChoiceToolChoiceForcedImpl
    extends SessionToolChoiceToolChoiceForced {
  const _$SessionToolChoiceToolChoiceForcedImpl(this.value,
      {final String? $type})
      : $type = $type ?? 'toolChoiceForced',
        super._();

  factory _$SessionToolChoiceToolChoiceForcedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$SessionToolChoiceToolChoiceForcedImplFromJson(json);

  @override
  final ToolChoiceForced value;

  @JsonKey(name: 'runtimeType')
  final String $type;

  @override
  String toString() {
    return 'SessionToolChoice.toolChoiceForced(value: $value)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$SessionToolChoiceToolChoiceForcedImpl &&
            (identical(other.value, value) || other.value == value));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, value);

  /// Create a copy of SessionToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$SessionToolChoiceToolChoiceForcedImplCopyWith<
          _$SessionToolChoiceToolChoiceForcedImpl>
      get copyWith => __$$SessionToolChoiceToolChoiceForcedImplCopyWithImpl<
          _$SessionToolChoiceToolChoiceForcedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(SessionToolChoiceMode value) mode,
    required TResult Function(ToolChoiceForced value) toolChoiceForced,
  }) {
    return toolChoiceForced(value);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(SessionToolChoiceMode value)? mode,
    TResult? Function(ToolChoiceForced value)? toolChoiceForced,
  }) {
    return toolChoiceForced?.call(value);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(SessionToolChoiceMode value)? mode,
    TResult Function(ToolChoiceForced value)? toolChoiceForced,
    required TResult orElse(),
  }) {
    if (toolChoiceForced != null) {
      return toolChoiceForced(value);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(SessionToolChoiceEnumeration value) mode,
    required TResult Function(SessionToolChoiceToolChoiceForced value)
        toolChoiceForced,
  }) {
    return toolChoiceForced(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(SessionToolChoiceEnumeration value)? mode,
    TResult? Function(SessionToolChoiceToolChoiceForced value)?
        toolChoiceForced,
  }) {
    return toolChoiceForced?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(SessionToolChoiceEnumeration value)? mode,
    TResult Function(SessionToolChoiceToolChoiceForced value)? toolChoiceForced,
    required TResult orElse(),
  }) {
    if (toolChoiceForced != null) {
      return toolChoiceForced(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$SessionToolChoiceToolChoiceForcedImplToJson(
      this,
    );
  }
}

abstract class SessionToolChoiceToolChoiceForced extends SessionToolChoice {
  const factory SessionToolChoiceToolChoiceForced(
      final ToolChoiceForced value) = _$SessionToolChoiceToolChoiceForcedImpl;
  const SessionToolChoiceToolChoiceForced._() : super._();

  factory SessionToolChoiceToolChoiceForced.fromJson(
          Map<String, dynamic> json) =
      _$SessionToolChoiceToolChoiceForcedImpl.fromJson;

  @override
  ToolChoiceForced get value;

  /// Create a copy of SessionToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$SessionToolChoiceToolChoiceForcedImplCopyWith<
          _$SessionToolChoiceToolChoiceForcedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

SessionMaxResponseOutputTokens _$SessionMaxResponseOutputTokensFromJson(
    Map<String, dynamic> json) {
  switch (json['runtimeType']) {
    case 'int':
      return SessionMaxResponseOutputTokensInt.fromJson(json);
    case 'string':
      return SessionMaxResponseOutputTokensString.fromJson(json);

    default:
      throw CheckedFromJsonException(
          json,
          'runtimeType',
          'SessionMaxResponseOutputTokens',
          'Invalid union type "${json['runtimeType']}"!');
  }
}

/// @nodoc
mixin _$SessionMaxResponseOutputTokens {
  Object get value => throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(int value) int,
    required TResult Function(String value) string,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(int value)? int,
    TResult? Function(String value)? string,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(int value)? int,
    TResult Function(String value)? string,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(SessionMaxResponseOutputTokensInt value) int,
    required TResult Function(SessionMaxResponseOutputTokensString value)
        string,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(SessionMaxResponseOutputTokensInt value)? int,
    TResult? Function(SessionMaxResponseOutputTokensString value)? string,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(SessionMaxResponseOutputTokensInt value)? int,
    TResult Function(SessionMaxResponseOutputTokensString value)? string,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;

  /// Serializes this SessionMaxResponseOutputTokens to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $SessionMaxResponseOutputTokensCopyWith<$Res> {
  factory $SessionMaxResponseOutputTokensCopyWith(
          SessionMaxResponseOutputTokens value,
          $Res Function(SessionMaxResponseOutputTokens) then) =
      _$SessionMaxResponseOutputTokensCopyWithImpl<$Res,
          SessionMaxResponseOutputTokens>;
}

/// @nodoc
class _$SessionMaxResponseOutputTokensCopyWithImpl<$Res,
        $Val extends SessionMaxResponseOutputTokens>
    implements $SessionMaxResponseOutputTokensCopyWith<$Res> {
  _$SessionMaxResponseOutputTokensCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of SessionMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
}

/// @nodoc
abstract class _$$SessionMaxResponseOutputTokensIntImplCopyWith<$Res> {
  factory _$$SessionMaxResponseOutputTokensIntImplCopyWith(
          _$SessionMaxResponseOutputTokensIntImpl value,
          $Res Function(_$SessionMaxResponseOutputTokensIntImpl) then) =
      __$$SessionMaxResponseOutputTokensIntImplCopyWithImpl<$Res>;
  @useResult
  $Res call({int value});
}

/// @nodoc
class __$$SessionMaxResponseOutputTokensIntImplCopyWithImpl<$Res>
    extends _$SessionMaxResponseOutputTokensCopyWithImpl<$Res,
        _$SessionMaxResponseOutputTokensIntImpl>
    implements _$$SessionMaxResponseOutputTokensIntImplCopyWith<$Res> {
  __$$SessionMaxResponseOutputTokensIntImplCopyWithImpl(
      _$SessionMaxResponseOutputTokensIntImpl _value,
      $Res Function(_$SessionMaxResponseOutputTokensIntImpl) _then)
      : super(_value, _then);

  /// Create a copy of SessionMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? value = null,
  }) {
    return _then(_$SessionMaxResponseOutputTokensIntImpl(
      null == value
          ? _value.value
          : value // ignore: cast_nullable_to_non_nullable
              as int,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$SessionMaxResponseOutputTokensIntImpl
    extends SessionMaxResponseOutputTokensInt {
  const _$SessionMaxResponseOutputTokensIntImpl(this.value,
      {final String? $type})
      : $type = $type ?? 'int',
        super._();

  factory _$SessionMaxResponseOutputTokensIntImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$SessionMaxResponseOutputTokensIntImplFromJson(json);

  @override
  final int value;

  @JsonKey(name: 'runtimeType')
  final String $type;

  @override
  String toString() {
    return 'SessionMaxResponseOutputTokens.int(value: $value)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$SessionMaxResponseOutputTokensIntImpl &&
            (identical(other.value, value) || other.value == value));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, value);

  /// Create a copy of SessionMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$SessionMaxResponseOutputTokensIntImplCopyWith<
          _$SessionMaxResponseOutputTokensIntImpl>
      get copyWith => __$$SessionMaxResponseOutputTokensIntImplCopyWithImpl<
          _$SessionMaxResponseOutputTokensIntImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(int value) int,
    required TResult Function(String value) string,
  }) {
    return int(value);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(int value)? int,
    TResult? Function(String value)? string,
  }) {
    return int?.call(value);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(int value)? int,
    TResult Function(String value)? string,
    required TResult orElse(),
  }) {
    if (int != null) {
      return int(value);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(SessionMaxResponseOutputTokensInt value) int,
    required TResult Function(SessionMaxResponseOutputTokensString value)
        string,
  }) {
    return int(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(SessionMaxResponseOutputTokensInt value)? int,
    TResult? Function(SessionMaxResponseOutputTokensString value)? string,
  }) {
    return int?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(SessionMaxResponseOutputTokensInt value)? int,
    TResult Function(SessionMaxResponseOutputTokensString value)? string,
    required TResult orElse(),
  }) {
    if (int != null) {
      return int(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$SessionMaxResponseOutputTokensIntImplToJson(
      this,
    );
  }
}

abstract class SessionMaxResponseOutputTokensInt
    extends SessionMaxResponseOutputTokens {
  const factory SessionMaxResponseOutputTokensInt(final int value) =
      _$SessionMaxResponseOutputTokensIntImpl;
  const SessionMaxResponseOutputTokensInt._() : super._();

  factory SessionMaxResponseOutputTokensInt.fromJson(
          Map<String, dynamic> json) =
      _$SessionMaxResponseOutputTokensIntImpl.fromJson;

  @override
  int get value;

  /// Create a copy of SessionMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$SessionMaxResponseOutputTokensIntImplCopyWith<
          _$SessionMaxResponseOutputTokensIntImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$SessionMaxResponseOutputTokensStringImplCopyWith<$Res> {
  factory _$$SessionMaxResponseOutputTokensStringImplCopyWith(
          _$SessionMaxResponseOutputTokensStringImpl value,
          $Res Function(_$SessionMaxResponseOutputTokensStringImpl) then) =
      __$$SessionMaxResponseOutputTokensStringImplCopyWithImpl<$Res>;
  @useResult
  $Res call({String value});
}

/// @nodoc
class __$$SessionMaxResponseOutputTokensStringImplCopyWithImpl<$Res>
    extends _$SessionMaxResponseOutputTokensCopyWithImpl<$Res,
        _$SessionMaxResponseOutputTokensStringImpl>
    implements _$$SessionMaxResponseOutputTokensStringImplCopyWith<$Res> {
  __$$SessionMaxResponseOutputTokensStringImplCopyWithImpl(
      _$SessionMaxResponseOutputTokensStringImpl _value,
      $Res Function(_$SessionMaxResponseOutputTokensStringImpl) _then)
      : super(_value, _then);

  /// Create a copy of SessionMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? value = null,
  }) {
    return _then(_$SessionMaxResponseOutputTokensStringImpl(
      null == value
          ? _value.value
          : value // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$SessionMaxResponseOutputTokensStringImpl
    extends SessionMaxResponseOutputTokensString {
  const _$SessionMaxResponseOutputTokensStringImpl(this.value,
      {final String? $type})
      : $type = $type ?? 'string',
        super._();

  factory _$SessionMaxResponseOutputTokensStringImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$SessionMaxResponseOutputTokensStringImplFromJson(json);

  @override
  final String value;

  @JsonKey(name: 'runtimeType')
  final String $type;

  @override
  String toString() {
    return 'SessionMaxResponseOutputTokens.string(value: $value)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$SessionMaxResponseOutputTokensStringImpl &&
            (identical(other.value, value) || other.value == value));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, value);

  /// Create a copy of SessionMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$SessionMaxResponseOutputTokensStringImplCopyWith<
          _$SessionMaxResponseOutputTokensStringImpl>
      get copyWith => __$$SessionMaxResponseOutputTokensStringImplCopyWithImpl<
          _$SessionMaxResponseOutputTokensStringImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(int value) int,
    required TResult Function(String value) string,
  }) {
    return string(value);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(int value)? int,
    TResult? Function(String value)? string,
  }) {
    return string?.call(value);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(int value)? int,
    TResult Function(String value)? string,
    required TResult orElse(),
  }) {
    if (string != null) {
      return string(value);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(SessionMaxResponseOutputTokensInt value) int,
    required TResult Function(SessionMaxResponseOutputTokensString value)
        string,
  }) {
    return string(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(SessionMaxResponseOutputTokensInt value)? int,
    TResult? Function(SessionMaxResponseOutputTokensString value)? string,
  }) {
    return string?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(SessionMaxResponseOutputTokensInt value)? int,
    TResult Function(SessionMaxResponseOutputTokensString value)? string,
    required TResult orElse(),
  }) {
    if (string != null) {
      return string(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$SessionMaxResponseOutputTokensStringImplToJson(
      this,
    );
  }
}

abstract class SessionMaxResponseOutputTokensString
    extends SessionMaxResponseOutputTokens {
  const factory SessionMaxResponseOutputTokensString(final String value) =
      _$SessionMaxResponseOutputTokensStringImpl;
  const SessionMaxResponseOutputTokensString._() : super._();

  factory SessionMaxResponseOutputTokensString.fromJson(
          Map<String, dynamic> json) =
      _$SessionMaxResponseOutputTokensStringImpl.fromJson;

  @override
  String get value;

  /// Create a copy of SessionMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$SessionMaxResponseOutputTokensStringImplCopyWith<
          _$SessionMaxResponseOutputTokensStringImpl>
      get copyWith => throw _privateConstructorUsedError;
}

SessionConfig _$SessionConfigFromJson(Map<String, dynamic> json) {
  return _SessionConfig.fromJson(json);
}

/// @nodoc
mixin _$SessionConfig {
  /// The set of modalities the model can respond with. To disable audio, set this to ["text"].
  @JsonKey(includeIfNull: false)
  List<Modality>? get modalities => throw _privateConstructorUsedError;

  /// The default system instructions (i.e. system message) prepended to model
  /// calls. This field allows the client to guide the model on desired
  /// responses. The model can be instructed on response content and format,
  /// (e.g. "be extremely succinct", "act friendly", "here are examples of good
  /// responses") and on audio behavior (e.g. "talk quickly", "inject emotion
  /// into your voice", "laugh frequently"). The instructions are not guaranteed
  /// to be followed by the model, but they provide guidance to the model on the
  /// desired behavior.
  ///
  /// Note that the server sets default instructions which will be used if this
  /// field is not set and are visible in the `session.created` event at the
  /// start of the session.
  @JsonKey(includeIfNull: false)
  String? get instructions => throw _privateConstructorUsedError;

  /// The voice the model uses to respond. Supported voices are `alloy`, `ash`,
  /// `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`. Cannot be
  /// changed once the model has responded with audio at least once.
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  Voice? get voice => throw _privateConstructorUsedError;

  /// The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
  @JsonKey(
      name: 'input_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  AudioFormat? get inputAudioFormat => throw _privateConstructorUsedError;

  /// The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
  @JsonKey(
      name: 'output_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  AudioFormat? get outputAudioFormat => throw _privateConstructorUsedError;

  /// Configuration for input audio transcription, defaults to off and can be
  /// set to `null` to turn off once on. Input audio transcription is not native
  /// to the model, since the model consumes audio directly. Transcription runs
  /// asynchronously through Whisper and should be treated as rough guidance
  /// rather than the representation understood by the model.
  @JsonKey(name: 'input_audio_transcription', includeIfNull: false)
  InputAudioTranscriptionConfig? get inputAudioTranscription =>
      throw _privateConstructorUsedError;

  /// Configuration for turn detection. Can be set to `null` to turn off. Server
  /// VAD means that the model will detect the start and end of speech based on
  /// audio volume and respond at the end of user speech.
  @JsonKey(name: 'turn_detection', includeIfNull: false)
  TurnDetection? get turnDetection => throw _privateConstructorUsedError;

  /// Tools (functions) available to the model.
  @JsonKey(includeIfNull: false)
  List<ToolDefinition>? get tools => throw _privateConstructorUsedError;

  /// How the model chooses tools. Options are `auto`, `none`, `required`, or
  /// specify a function.
  @_SessionConfigToolChoiceConverter()
  @JsonKey(name: 'tool_choice', includeIfNull: false)
  SessionConfigToolChoice? get toolChoice => throw _privateConstructorUsedError;

  /// Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.
  @JsonKey(includeIfNull: false)
  double? get temperature => throw _privateConstructorUsedError;

  /// Maximum number of output tokens for a single assistant response,
  /// inclusive of tool calls. Provide an integer between 1 and 4096 to
  /// limit output tokens, or `inf` for the maximum available tokens for a
  /// given model. Defaults to `inf`.
  @_SessionConfigMaxResponseOutputTokensConverter()
  @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
  SessionConfigMaxResponseOutputTokens? get maxResponseOutputTokens =>
      throw _privateConstructorUsedError;

  /// Serializes this SessionConfig to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of SessionConfig
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $SessionConfigCopyWith<SessionConfig> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $SessionConfigCopyWith<$Res> {
  factory $SessionConfigCopyWith(
          SessionConfig value, $Res Function(SessionConfig) then) =
      _$SessionConfigCopyWithImpl<$Res, SessionConfig>;
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) List<Modality>? modalities,
      @JsonKey(includeIfNull: false) String? instructions,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      Voice? voice,
      @JsonKey(
          name: 'input_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      AudioFormat? inputAudioFormat,
      @JsonKey(
          name: 'output_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      AudioFormat? outputAudioFormat,
      @JsonKey(name: 'input_audio_transcription', includeIfNull: false)
      InputAudioTranscriptionConfig? inputAudioTranscription,
      @JsonKey(name: 'turn_detection', includeIfNull: false)
      TurnDetection? turnDetection,
      @JsonKey(includeIfNull: false) List<ToolDefinition>? tools,
      @_SessionConfigToolChoiceConverter()
      @JsonKey(name: 'tool_choice', includeIfNull: false)
      SessionConfigToolChoice? toolChoice,
      @JsonKey(includeIfNull: false) double? temperature,
      @_SessionConfigMaxResponseOutputTokensConverter()
      @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
      SessionConfigMaxResponseOutputTokens? maxResponseOutputTokens});

  $InputAudioTranscriptionConfigCopyWith<$Res>? get inputAudioTranscription;
  $TurnDetectionCopyWith<$Res>? get turnDetection;
  $SessionConfigToolChoiceCopyWith<$Res>? get toolChoice;
  $SessionConfigMaxResponseOutputTokensCopyWith<$Res>?
      get maxResponseOutputTokens;
}

/// @nodoc
class _$SessionConfigCopyWithImpl<$Res, $Val extends SessionConfig>
    implements $SessionConfigCopyWith<$Res> {
  _$SessionConfigCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of SessionConfig
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? modalities = freezed,
    Object? instructions = freezed,
    Object? voice = freezed,
    Object? inputAudioFormat = freezed,
    Object? outputAudioFormat = freezed,
    Object? inputAudioTranscription = freezed,
    Object? turnDetection = freezed,
    Object? tools = freezed,
    Object? toolChoice = freezed,
    Object? temperature = freezed,
    Object? maxResponseOutputTokens = freezed,
  }) {
    return _then(_value.copyWith(
      modalities: freezed == modalities
          ? _value.modalities
          : modalities // ignore: cast_nullable_to_non_nullable
              as List<Modality>?,
      instructions: freezed == instructions
          ? _value.instructions
          : instructions // ignore: cast_nullable_to_non_nullable
              as String?,
      voice: freezed == voice
          ? _value.voice
          : voice // ignore: cast_nullable_to_non_nullable
              as Voice?,
      inputAudioFormat: freezed == inputAudioFormat
          ? _value.inputAudioFormat
          : inputAudioFormat // ignore: cast_nullable_to_non_nullable
              as AudioFormat?,
      outputAudioFormat: freezed == outputAudioFormat
          ? _value.outputAudioFormat
          : outputAudioFormat // ignore: cast_nullable_to_non_nullable
              as AudioFormat?,
      inputAudioTranscription: freezed == inputAudioTranscription
          ? _value.inputAudioTranscription
          : inputAudioTranscription // ignore: cast_nullable_to_non_nullable
              as InputAudioTranscriptionConfig?,
      turnDetection: freezed == turnDetection
          ? _value.turnDetection
          : turnDetection // ignore: cast_nullable_to_non_nullable
              as TurnDetection?,
      tools: freezed == tools
          ? _value.tools
          : tools // ignore: cast_nullable_to_non_nullable
              as List<ToolDefinition>?,
      toolChoice: freezed == toolChoice
          ? _value.toolChoice
          : toolChoice // ignore: cast_nullable_to_non_nullable
              as SessionConfigToolChoice?,
      temperature: freezed == temperature
          ? _value.temperature
          : temperature // ignore: cast_nullable_to_non_nullable
              as double?,
      maxResponseOutputTokens: freezed == maxResponseOutputTokens
          ? _value.maxResponseOutputTokens
          : maxResponseOutputTokens // ignore: cast_nullable_to_non_nullable
              as SessionConfigMaxResponseOutputTokens?,
    ) as $Val);
  }

  /// Create a copy of SessionConfig
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $InputAudioTranscriptionConfigCopyWith<$Res>? get inputAudioTranscription {
    if (_value.inputAudioTranscription == null) {
      return null;
    }

    return $InputAudioTranscriptionConfigCopyWith<$Res>(
        _value.inputAudioTranscription!, (value) {
      return _then(_value.copyWith(inputAudioTranscription: value) as $Val);
    });
  }

  /// Create a copy of SessionConfig
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $TurnDetectionCopyWith<$Res>? get turnDetection {
    if (_value.turnDetection == null) {
      return null;
    }

    return $TurnDetectionCopyWith<$Res>(_value.turnDetection!, (value) {
      return _then(_value.copyWith(turnDetection: value) as $Val);
    });
  }

  /// Create a copy of SessionConfig
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $SessionConfigToolChoiceCopyWith<$Res>? get toolChoice {
    if (_value.toolChoice == null) {
      return null;
    }

    return $SessionConfigToolChoiceCopyWith<$Res>(_value.toolChoice!, (value) {
      return _then(_value.copyWith(toolChoice: value) as $Val);
    });
  }

  /// Create a copy of SessionConfig
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $SessionConfigMaxResponseOutputTokensCopyWith<$Res>?
      get maxResponseOutputTokens {
    if (_value.maxResponseOutputTokens == null) {
      return null;
    }

    return $SessionConfigMaxResponseOutputTokensCopyWith<$Res>(
        _value.maxResponseOutputTokens!, (value) {
      return _then(_value.copyWith(maxResponseOutputTokens: value) as $Val);
    });
  }
}

/// @nodoc
abstract class _$$SessionConfigImplCopyWith<$Res>
    implements $SessionConfigCopyWith<$Res> {
  factory _$$SessionConfigImplCopyWith(
          _$SessionConfigImpl value, $Res Function(_$SessionConfigImpl) then) =
      __$$SessionConfigImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) List<Modality>? modalities,
      @JsonKey(includeIfNull: false) String? instructions,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      Voice? voice,
      @JsonKey(
          name: 'input_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      AudioFormat? inputAudioFormat,
      @JsonKey(
          name: 'output_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      AudioFormat? outputAudioFormat,
      @JsonKey(name: 'input_audio_transcription', includeIfNull: false)
      InputAudioTranscriptionConfig? inputAudioTranscription,
      @JsonKey(name: 'turn_detection', includeIfNull: false)
      TurnDetection? turnDetection,
      @JsonKey(includeIfNull: false) List<ToolDefinition>? tools,
      @_SessionConfigToolChoiceConverter()
      @JsonKey(name: 'tool_choice', includeIfNull: false)
      SessionConfigToolChoice? toolChoice,
      @JsonKey(includeIfNull: false) double? temperature,
      @_SessionConfigMaxResponseOutputTokensConverter()
      @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
      SessionConfigMaxResponseOutputTokens? maxResponseOutputTokens});

  @override
  $InputAudioTranscriptionConfigCopyWith<$Res>? get inputAudioTranscription;
  @override
  $TurnDetectionCopyWith<$Res>? get turnDetection;
  @override
  $SessionConfigToolChoiceCopyWith<$Res>? get toolChoice;
  @override
  $SessionConfigMaxResponseOutputTokensCopyWith<$Res>?
      get maxResponseOutputTokens;
}

/// @nodoc
class __$$SessionConfigImplCopyWithImpl<$Res>
    extends _$SessionConfigCopyWithImpl<$Res, _$SessionConfigImpl>
    implements _$$SessionConfigImplCopyWith<$Res> {
  __$$SessionConfigImplCopyWithImpl(
      _$SessionConfigImpl _value, $Res Function(_$SessionConfigImpl) _then)
      : super(_value, _then);

  /// Create a copy of SessionConfig
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? modalities = freezed,
    Object? instructions = freezed,
    Object? voice = freezed,
    Object? inputAudioFormat = freezed,
    Object? outputAudioFormat = freezed,
    Object? inputAudioTranscription = freezed,
    Object? turnDetection = freezed,
    Object? tools = freezed,
    Object? toolChoice = freezed,
    Object? temperature = freezed,
    Object? maxResponseOutputTokens = freezed,
  }) {
    return _then(_$SessionConfigImpl(
      modalities: freezed == modalities
          ? _value._modalities
          : modalities // ignore: cast_nullable_to_non_nullable
              as List<Modality>?,
      instructions: freezed == instructions
          ? _value.instructions
          : instructions // ignore: cast_nullable_to_non_nullable
              as String?,
      voice: freezed == voice
          ? _value.voice
          : voice // ignore: cast_nullable_to_non_nullable
              as Voice?,
      inputAudioFormat: freezed == inputAudioFormat
          ? _value.inputAudioFormat
          : inputAudioFormat // ignore: cast_nullable_to_non_nullable
              as AudioFormat?,
      outputAudioFormat: freezed == outputAudioFormat
          ? _value.outputAudioFormat
          : outputAudioFormat // ignore: cast_nullable_to_non_nullable
              as AudioFormat?,
      inputAudioTranscription: freezed == inputAudioTranscription
          ? _value.inputAudioTranscription
          : inputAudioTranscription // ignore: cast_nullable_to_non_nullable
              as InputAudioTranscriptionConfig?,
      turnDetection: freezed == turnDetection
          ? _value.turnDetection
          : turnDetection // ignore: cast_nullable_to_non_nullable
              as TurnDetection?,
      tools: freezed == tools
          ? _value._tools
          : tools // ignore: cast_nullable_to_non_nullable
              as List<ToolDefinition>?,
      toolChoice: freezed == toolChoice
          ? _value.toolChoice
          : toolChoice // ignore: cast_nullable_to_non_nullable
              as SessionConfigToolChoice?,
      temperature: freezed == temperature
          ? _value.temperature
          : temperature // ignore: cast_nullable_to_non_nullable
              as double?,
      maxResponseOutputTokens: freezed == maxResponseOutputTokens
          ? _value.maxResponseOutputTokens
          : maxResponseOutputTokens // ignore: cast_nullable_to_non_nullable
              as SessionConfigMaxResponseOutputTokens?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$SessionConfigImpl extends _SessionConfig {
  const _$SessionConfigImpl(
      {@JsonKey(includeIfNull: false) final List<Modality>? modalities,
      @JsonKey(includeIfNull: false) this.instructions,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.voice,
      @JsonKey(
          name: 'input_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.inputAudioFormat,
      @JsonKey(
          name: 'output_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.outputAudioFormat,
      @JsonKey(name: 'input_audio_transcription', includeIfNull: false)
      this.inputAudioTranscription,
      @JsonKey(name: 'turn_detection', includeIfNull: false) this.turnDetection,
      @JsonKey(includeIfNull: false) final List<ToolDefinition>? tools,
      @_SessionConfigToolChoiceConverter()
      @JsonKey(name: 'tool_choice', includeIfNull: false)
      this.toolChoice,
      @JsonKey(includeIfNull: false) this.temperature,
      @_SessionConfigMaxResponseOutputTokensConverter()
      @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
      this.maxResponseOutputTokens})
      : _modalities = modalities,
        _tools = tools,
        super._();

  factory _$SessionConfigImpl.fromJson(Map<String, dynamic> json) =>
      _$$SessionConfigImplFromJson(json);

  /// The set of modalities the model can respond with. To disable audio, set this to ["text"].
  final List<Modality>? _modalities;

  /// The set of modalities the model can respond with. To disable audio, set this to ["text"].
  @override
  @JsonKey(includeIfNull: false)
  List<Modality>? get modalities {
    final value = _modalities;
    if (value == null) return null;
    if (_modalities is EqualUnmodifiableListView) return _modalities;
    // ignore: implicit_dynamic_type
    return EqualUnmodifiableListView(value);
  }

  /// The default system instructions (i.e. system message) prepended to model
  /// calls. This field allows the client to guide the model on desired
  /// responses. The model can be instructed on response content and format,
  /// (e.g. "be extremely succinct", "act friendly", "here are examples of good
  /// responses") and on audio behavior (e.g. "talk quickly", "inject emotion
  /// into your voice", "laugh frequently"). The instructions are not guaranteed
  /// to be followed by the model, but they provide guidance to the model on the
  /// desired behavior.
  ///
  /// Note that the server sets default instructions which will be used if this
  /// field is not set and are visible in the `session.created` event at the
  /// start of the session.
  @override
  @JsonKey(includeIfNull: false)
  final String? instructions;

  /// The voice the model uses to respond. Supported voices are `alloy`, `ash`,
  /// `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`. Cannot be
  /// changed once the model has responded with audio at least once.
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final Voice? voice;

  /// The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
  @override
  @JsonKey(
      name: 'input_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final AudioFormat? inputAudioFormat;

  /// The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
  @override
  @JsonKey(
      name: 'output_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final AudioFormat? outputAudioFormat;

  /// Configuration for input audio transcription, defaults to off and can be
  /// set to `null` to turn off once on. Input audio transcription is not native
  /// to the model, since the model consumes audio directly. Transcription runs
  /// asynchronously through Whisper and should be treated as rough guidance
  /// rather than the representation understood by the model.
  @override
  @JsonKey(name: 'input_audio_transcription', includeIfNull: false)
  final InputAudioTranscriptionConfig? inputAudioTranscription;

  /// Configuration for turn detection. Can be set to `null` to turn off. Server
  /// VAD means that the model will detect the start and end of speech based on
  /// audio volume and respond at the end of user speech.
  @override
  @JsonKey(name: 'turn_detection', includeIfNull: false)
  final TurnDetection? turnDetection;

  /// Tools (functions) available to the model.
  final List<ToolDefinition>? _tools;

  /// Tools (functions) available to the model.
  @override
  @JsonKey(includeIfNull: false)
  List<ToolDefinition>? get tools {
    final value = _tools;
    if (value == null) return null;
    if (_tools is EqualUnmodifiableListView) return _tools;
    // ignore: implicit_dynamic_type
    return EqualUnmodifiableListView(value);
  }

  /// How the model chooses tools. Options are `auto`, `none`, `required`, or
  /// specify a function.
  @override
  @_SessionConfigToolChoiceConverter()
  @JsonKey(name: 'tool_choice', includeIfNull: false)
  final SessionConfigToolChoice? toolChoice;

  /// Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.
  @override
  @JsonKey(includeIfNull: false)
  final double? temperature;

  /// Maximum number of output tokens for a single assistant response,
  /// inclusive of tool calls. Provide an integer between 1 and 4096 to
  /// limit output tokens, or `inf` for the maximum available tokens for a
  /// given model. Defaults to `inf`.
  @override
  @_SessionConfigMaxResponseOutputTokensConverter()
  @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
  final SessionConfigMaxResponseOutputTokens? maxResponseOutputTokens;

  @override
  String toString() {
    return 'SessionConfig(modalities: $modalities, instructions: $instructions, voice: $voice, inputAudioFormat: $inputAudioFormat, outputAudioFormat: $outputAudioFormat, inputAudioTranscription: $inputAudioTranscription, turnDetection: $turnDetection, tools: $tools, toolChoice: $toolChoice, temperature: $temperature, maxResponseOutputTokens: $maxResponseOutputTokens)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$SessionConfigImpl &&
            const DeepCollectionEquality()
                .equals(other._modalities, _modalities) &&
            (identical(other.instructions, instructions) ||
                other.instructions == instructions) &&
            (identical(other.voice, voice) || other.voice == voice) &&
            (identical(other.inputAudioFormat, inputAudioFormat) ||
                other.inputAudioFormat == inputAudioFormat) &&
            (identical(other.outputAudioFormat, outputAudioFormat) ||
                other.outputAudioFormat == outputAudioFormat) &&
            (identical(
                    other.inputAudioTranscription, inputAudioTranscription) ||
                other.inputAudioTranscription == inputAudioTranscription) &&
            (identical(other.turnDetection, turnDetection) ||
                other.turnDetection == turnDetection) &&
            const DeepCollectionEquality().equals(other._tools, _tools) &&
            (identical(other.toolChoice, toolChoice) ||
                other.toolChoice == toolChoice) &&
            (identical(other.temperature, temperature) ||
                other.temperature == temperature) &&
            (identical(
                    other.maxResponseOutputTokens, maxResponseOutputTokens) ||
                other.maxResponseOutputTokens == maxResponseOutputTokens));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(
      runtimeType,
      const DeepCollectionEquality().hash(_modalities),
      instructions,
      voice,
      inputAudioFormat,
      outputAudioFormat,
      inputAudioTranscription,
      turnDetection,
      const DeepCollectionEquality().hash(_tools),
      toolChoice,
      temperature,
      maxResponseOutputTokens);

  /// Create a copy of SessionConfig
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$SessionConfigImplCopyWith<_$SessionConfigImpl> get copyWith =>
      __$$SessionConfigImplCopyWithImpl<_$SessionConfigImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$SessionConfigImplToJson(
      this,
    );
  }
}

abstract class _SessionConfig extends SessionConfig {
  const factory _SessionConfig(
      {@JsonKey(includeIfNull: false) final List<Modality>? modalities,
      @JsonKey(includeIfNull: false) final String? instructions,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      final Voice? voice,
      @JsonKey(
          name: 'input_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      final AudioFormat? inputAudioFormat,
      @JsonKey(
          name: 'output_audio_format',
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      final AudioFormat? outputAudioFormat,
      @JsonKey(name: 'input_audio_transcription', includeIfNull: false)
      final InputAudioTranscriptionConfig? inputAudioTranscription,
      @JsonKey(name: 'turn_detection', includeIfNull: false)
      final TurnDetection? turnDetection,
      @JsonKey(includeIfNull: false) final List<ToolDefinition>? tools,
      @_SessionConfigToolChoiceConverter()
      @JsonKey(name: 'tool_choice', includeIfNull: false)
      final SessionConfigToolChoice? toolChoice,
      @JsonKey(includeIfNull: false) final double? temperature,
      @_SessionConfigMaxResponseOutputTokensConverter()
      @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
      final SessionConfigMaxResponseOutputTokens?
          maxResponseOutputTokens}) = _$SessionConfigImpl;
  const _SessionConfig._() : super._();

  factory _SessionConfig.fromJson(Map<String, dynamic> json) =
      _$SessionConfigImpl.fromJson;

  /// The set of modalities the model can respond with. To disable audio, set this to ["text"].
  @override
  @JsonKey(includeIfNull: false)
  List<Modality>? get modalities;

  /// The default system instructions (i.e. system message) prepended to model
  /// calls. This field allows the client to guide the model on desired
  /// responses. The model can be instructed on response content and format,
  /// (e.g. "be extremely succinct", "act friendly", "here are examples of good
  /// responses") and on audio behavior (e.g. "talk quickly", "inject emotion
  /// into your voice", "laugh frequently"). The instructions are not guaranteed
  /// to be followed by the model, but they provide guidance to the model on the
  /// desired behavior.
  ///
  /// Note that the server sets default instructions which will be used if this
  /// field is not set and are visible in the `session.created` event at the
  /// start of the session.
  @override
  @JsonKey(includeIfNull: false)
  String? get instructions;

  /// The voice the model uses to respond. Supported voices are `alloy`, `ash`,
  /// `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`. Cannot be
  /// changed once the model has responded with audio at least once.
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  Voice? get voice;

  /// The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
  @override
  @JsonKey(
      name: 'input_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  AudioFormat? get inputAudioFormat;

  /// The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
  @override
  @JsonKey(
      name: 'output_audio_format',
      includeIfNull: false,
      unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  AudioFormat? get outputAudioFormat;

  /// Configuration for input audio transcription, defaults to off and can be
  /// set to `null` to turn off once on. Input audio transcription is not native
  /// to the model, since the model consumes audio directly. Transcription runs
  /// asynchronously through Whisper and should be treated as rough guidance
  /// rather than the representation understood by the model.
  @override
  @JsonKey(name: 'input_audio_transcription', includeIfNull: false)
  InputAudioTranscriptionConfig? get inputAudioTranscription;

  /// Configuration for turn detection. Can be set to `null` to turn off. Server
  /// VAD means that the model will detect the start and end of speech based on
  /// audio volume and respond at the end of user speech.
  @override
  @JsonKey(name: 'turn_detection', includeIfNull: false)
  TurnDetection? get turnDetection;

  /// Tools (functions) available to the model.
  @override
  @JsonKey(includeIfNull: false)
  List<ToolDefinition>? get tools;

  /// How the model chooses tools. Options are `auto`, `none`, `required`, or
  /// specify a function.
  @override
  @_SessionConfigToolChoiceConverter()
  @JsonKey(name: 'tool_choice', includeIfNull: false)
  SessionConfigToolChoice? get toolChoice;

  /// Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.
  @override
  @JsonKey(includeIfNull: false)
  double? get temperature;

  /// Maximum number of output tokens for a single assistant response,
  /// inclusive of tool calls. Provide an integer between 1 and 4096 to
  /// limit output tokens, or `inf` for the maximum available tokens for a
  /// given model. Defaults to `inf`.
  @override
  @_SessionConfigMaxResponseOutputTokensConverter()
  @JsonKey(name: 'max_response_output_tokens', includeIfNull: false)
  SessionConfigMaxResponseOutputTokens? get maxResponseOutputTokens;

  /// Create a copy of SessionConfig
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$SessionConfigImplCopyWith<_$SessionConfigImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

SessionConfigToolChoice _$SessionConfigToolChoiceFromJson(
    Map<String, dynamic> json) {
  switch (json['runtimeType']) {
    case 'mode':
      return SessionConfigToolChoiceEnumeration.fromJson(json);
    case 'toolChoiceForced':
      return SessionConfigToolChoiceToolChoiceForced.fromJson(json);

    default:
      throw CheckedFromJsonException(
          json,
          'runtimeType',
          'SessionConfigToolChoice',
          'Invalid union type "${json['runtimeType']}"!');
  }
}

/// @nodoc
mixin _$SessionConfigToolChoice {
  Object get value => throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(SessionConfigToolChoiceMode value) mode,
    required TResult Function(ToolChoiceForced value) toolChoiceForced,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(SessionConfigToolChoiceMode value)? mode,
    TResult? Function(ToolChoiceForced value)? toolChoiceForced,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(SessionConfigToolChoiceMode value)? mode,
    TResult Function(ToolChoiceForced value)? toolChoiceForced,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(SessionConfigToolChoiceEnumeration value) mode,
    required TResult Function(SessionConfigToolChoiceToolChoiceForced value)
        toolChoiceForced,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(SessionConfigToolChoiceEnumeration value)? mode,
    TResult? Function(SessionConfigToolChoiceToolChoiceForced value)?
        toolChoiceForced,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(SessionConfigToolChoiceEnumeration value)? mode,
    TResult Function(SessionConfigToolChoiceToolChoiceForced value)?
        toolChoiceForced,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;

  /// Serializes this SessionConfigToolChoice to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $SessionConfigToolChoiceCopyWith<$Res> {
  factory $SessionConfigToolChoiceCopyWith(SessionConfigToolChoice value,
          $Res Function(SessionConfigToolChoice) then) =
      _$SessionConfigToolChoiceCopyWithImpl<$Res, SessionConfigToolChoice>;
}

/// @nodoc
class _$SessionConfigToolChoiceCopyWithImpl<$Res,
        $Val extends SessionConfigToolChoice>
    implements $SessionConfigToolChoiceCopyWith<$Res> {
  _$SessionConfigToolChoiceCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of SessionConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
}

/// @nodoc
abstract class _$$SessionConfigToolChoiceEnumerationImplCopyWith<$Res> {
  factory _$$SessionConfigToolChoiceEnumerationImplCopyWith(
          _$SessionConfigToolChoiceEnumerationImpl value,
          $Res Function(_$SessionConfigToolChoiceEnumerationImpl) then) =
      __$$SessionConfigToolChoiceEnumerationImplCopyWithImpl<$Res>;
  @useResult
  $Res call({SessionConfigToolChoiceMode value});
}

/// @nodoc
class __$$SessionConfigToolChoiceEnumerationImplCopyWithImpl<$Res>
    extends _$SessionConfigToolChoiceCopyWithImpl<$Res,
        _$SessionConfigToolChoiceEnumerationImpl>
    implements _$$SessionConfigToolChoiceEnumerationImplCopyWith<$Res> {
  __$$SessionConfigToolChoiceEnumerationImplCopyWithImpl(
      _$SessionConfigToolChoiceEnumerationImpl _value,
      $Res Function(_$SessionConfigToolChoiceEnumerationImpl) _then)
      : super(_value, _then);

  /// Create a copy of SessionConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? value = null,
  }) {
    return _then(_$SessionConfigToolChoiceEnumerationImpl(
      null == value
          ? _value.value
          : value // ignore: cast_nullable_to_non_nullable
              as SessionConfigToolChoiceMode,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$SessionConfigToolChoiceEnumerationImpl
    extends SessionConfigToolChoiceEnumeration {
  const _$SessionConfigToolChoiceEnumerationImpl(this.value,
      {final String? $type})
      : $type = $type ?? 'mode',
        super._();

  factory _$SessionConfigToolChoiceEnumerationImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$SessionConfigToolChoiceEnumerationImplFromJson(json);

  @override
  final SessionConfigToolChoiceMode value;

  @JsonKey(name: 'runtimeType')
  final String $type;

  @override
  String toString() {
    return 'SessionConfigToolChoice.mode(value: $value)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$SessionConfigToolChoiceEnumerationImpl &&
            (identical(other.value, value) || other.value == value));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, value);

  /// Create a copy of SessionConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$SessionConfigToolChoiceEnumerationImplCopyWith<
          _$SessionConfigToolChoiceEnumerationImpl>
      get copyWith => __$$SessionConfigToolChoiceEnumerationImplCopyWithImpl<
          _$SessionConfigToolChoiceEnumerationImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(SessionConfigToolChoiceMode value) mode,
    required TResult Function(ToolChoiceForced value) toolChoiceForced,
  }) {
    return mode(value);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(SessionConfigToolChoiceMode value)? mode,
    TResult? Function(ToolChoiceForced value)? toolChoiceForced,
  }) {
    return mode?.call(value);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(SessionConfigToolChoiceMode value)? mode,
    TResult Function(ToolChoiceForced value)? toolChoiceForced,
    required TResult orElse(),
  }) {
    if (mode != null) {
      return mode(value);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(SessionConfigToolChoiceEnumeration value) mode,
    required TResult Function(SessionConfigToolChoiceToolChoiceForced value)
        toolChoiceForced,
  }) {
    return mode(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(SessionConfigToolChoiceEnumeration value)? mode,
    TResult? Function(SessionConfigToolChoiceToolChoiceForced value)?
        toolChoiceForced,
  }) {
    return mode?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(SessionConfigToolChoiceEnumeration value)? mode,
    TResult Function(SessionConfigToolChoiceToolChoiceForced value)?
        toolChoiceForced,
    required TResult orElse(),
  }) {
    if (mode != null) {
      return mode(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$SessionConfigToolChoiceEnumerationImplToJson(
      this,
    );
  }
}

abstract class SessionConfigToolChoiceEnumeration
    extends SessionConfigToolChoice {
  const factory SessionConfigToolChoiceEnumeration(
          final SessionConfigToolChoiceMode value) =
      _$SessionConfigToolChoiceEnumerationImpl;
  const SessionConfigToolChoiceEnumeration._() : super._();

  factory SessionConfigToolChoiceEnumeration.fromJson(
          Map<String, dynamic> json) =
      _$SessionConfigToolChoiceEnumerationImpl.fromJson;

  @override
  SessionConfigToolChoiceMode get value;

  /// Create a copy of SessionConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$SessionConfigToolChoiceEnumerationImplCopyWith<
          _$SessionConfigToolChoiceEnumerationImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$SessionConfigToolChoiceToolChoiceForcedImplCopyWith<$Res> {
  factory _$$SessionConfigToolChoiceToolChoiceForcedImplCopyWith(
          _$SessionConfigToolChoiceToolChoiceForcedImpl value,
          $Res Function(_$SessionConfigToolChoiceToolChoiceForcedImpl) then) =
      __$$SessionConfigToolChoiceToolChoiceForcedImplCopyWithImpl<$Res>;
  @useResult
  $Res call({ToolChoiceForced value});

  $ToolChoiceForcedCopyWith<$Res> get value;
}

/// @nodoc
class __$$SessionConfigToolChoiceToolChoiceForcedImplCopyWithImpl<$Res>
    extends _$SessionConfigToolChoiceCopyWithImpl<$Res,
        _$SessionConfigToolChoiceToolChoiceForcedImpl>
    implements _$$SessionConfigToolChoiceToolChoiceForcedImplCopyWith<$Res> {
  __$$SessionConfigToolChoiceToolChoiceForcedImplCopyWithImpl(
      _$SessionConfigToolChoiceToolChoiceForcedImpl _value,
      $Res Function(_$SessionConfigToolChoiceToolChoiceForcedImpl) _then)
      : super(_value, _then);

  /// Create a copy of SessionConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? value = null,
  }) {
    return _then(_$SessionConfigToolChoiceToolChoiceForcedImpl(
      null == value
          ? _value.value
          : value // ignore: cast_nullable_to_non_nullable
              as ToolChoiceForced,
    ));
  }

  /// Create a copy of SessionConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ToolChoiceForcedCopyWith<$Res> get value {
    return $ToolChoiceForcedCopyWith<$Res>(_value.value, (value) {
      return _then(_value.copyWith(value: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$SessionConfigToolChoiceToolChoiceForcedImpl
    extends SessionConfigToolChoiceToolChoiceForced {
  const _$SessionConfigToolChoiceToolChoiceForcedImpl(this.value,
      {final String? $type})
      : $type = $type ?? 'toolChoiceForced',
        super._();

  factory _$SessionConfigToolChoiceToolChoiceForcedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$SessionConfigToolChoiceToolChoiceForcedImplFromJson(json);

  @override
  final ToolChoiceForced value;

  @JsonKey(name: 'runtimeType')
  final String $type;

  @override
  String toString() {
    return 'SessionConfigToolChoice.toolChoiceForced(value: $value)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$SessionConfigToolChoiceToolChoiceForcedImpl &&
            (identical(other.value, value) || other.value == value));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, value);

  /// Create a copy of SessionConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$SessionConfigToolChoiceToolChoiceForcedImplCopyWith<
          _$SessionConfigToolChoiceToolChoiceForcedImpl>
      get copyWith =>
          __$$SessionConfigToolChoiceToolChoiceForcedImplCopyWithImpl<
              _$SessionConfigToolChoiceToolChoiceForcedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(SessionConfigToolChoiceMode value) mode,
    required TResult Function(ToolChoiceForced value) toolChoiceForced,
  }) {
    return toolChoiceForced(value);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(SessionConfigToolChoiceMode value)? mode,
    TResult? Function(ToolChoiceForced value)? toolChoiceForced,
  }) {
    return toolChoiceForced?.call(value);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(SessionConfigToolChoiceMode value)? mode,
    TResult Function(ToolChoiceForced value)? toolChoiceForced,
    required TResult orElse(),
  }) {
    if (toolChoiceForced != null) {
      return toolChoiceForced(value);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(SessionConfigToolChoiceEnumeration value) mode,
    required TResult Function(SessionConfigToolChoiceToolChoiceForced value)
        toolChoiceForced,
  }) {
    return toolChoiceForced(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(SessionConfigToolChoiceEnumeration value)? mode,
    TResult? Function(SessionConfigToolChoiceToolChoiceForced value)?
        toolChoiceForced,
  }) {
    return toolChoiceForced?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(SessionConfigToolChoiceEnumeration value)? mode,
    TResult Function(SessionConfigToolChoiceToolChoiceForced value)?
        toolChoiceForced,
    required TResult orElse(),
  }) {
    if (toolChoiceForced != null) {
      return toolChoiceForced(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$SessionConfigToolChoiceToolChoiceForcedImplToJson(
      this,
    );
  }
}

abstract class SessionConfigToolChoiceToolChoiceForced
    extends SessionConfigToolChoice {
  const factory SessionConfigToolChoiceToolChoiceForced(
          final ToolChoiceForced value) =
      _$SessionConfigToolChoiceToolChoiceForcedImpl;
  const SessionConfigToolChoiceToolChoiceForced._() : super._();

  factory SessionConfigToolChoiceToolChoiceForced.fromJson(
          Map<String, dynamic> json) =
      _$SessionConfigToolChoiceToolChoiceForcedImpl.fromJson;

  @override
  ToolChoiceForced get value;

  /// Create a copy of SessionConfigToolChoice
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$SessionConfigToolChoiceToolChoiceForcedImplCopyWith<
          _$SessionConfigToolChoiceToolChoiceForcedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

SessionConfigMaxResponseOutputTokens
    _$SessionConfigMaxResponseOutputTokensFromJson(Map<String, dynamic> json) {
  switch (json['runtimeType']) {
    case 'int':
      return SessionConfigMaxResponseOutputTokensInt.fromJson(json);
    case 'string':
      return SessionConfigMaxResponseOutputTokensString.fromJson(json);

    default:
      throw CheckedFromJsonException(
          json,
          'runtimeType',
          'SessionConfigMaxResponseOutputTokens',
          'Invalid union type "${json['runtimeType']}"!');
  }
}

/// @nodoc
mixin _$SessionConfigMaxResponseOutputTokens {
  Object get value => throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(int value) int,
    required TResult Function(String value) string,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(int value)? int,
    TResult? Function(String value)? string,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(int value)? int,
    TResult Function(String value)? string,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(SessionConfigMaxResponseOutputTokensInt value)
        int,
    required TResult Function(SessionConfigMaxResponseOutputTokensString value)
        string,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(SessionConfigMaxResponseOutputTokensInt value)? int,
    TResult? Function(SessionConfigMaxResponseOutputTokensString value)? string,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(SessionConfigMaxResponseOutputTokensInt value)? int,
    TResult Function(SessionConfigMaxResponseOutputTokensString value)? string,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;

  /// Serializes this SessionConfigMaxResponseOutputTokens to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $SessionConfigMaxResponseOutputTokensCopyWith<$Res> {
  factory $SessionConfigMaxResponseOutputTokensCopyWith(
          SessionConfigMaxResponseOutputTokens value,
          $Res Function(SessionConfigMaxResponseOutputTokens) then) =
      _$SessionConfigMaxResponseOutputTokensCopyWithImpl<$Res,
          SessionConfigMaxResponseOutputTokens>;
}

/// @nodoc
class _$SessionConfigMaxResponseOutputTokensCopyWithImpl<$Res,
        $Val extends SessionConfigMaxResponseOutputTokens>
    implements $SessionConfigMaxResponseOutputTokensCopyWith<$Res> {
  _$SessionConfigMaxResponseOutputTokensCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of SessionConfigMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
}

/// @nodoc
abstract class _$$SessionConfigMaxResponseOutputTokensIntImplCopyWith<$Res> {
  factory _$$SessionConfigMaxResponseOutputTokensIntImplCopyWith(
          _$SessionConfigMaxResponseOutputTokensIntImpl value,
          $Res Function(_$SessionConfigMaxResponseOutputTokensIntImpl) then) =
      __$$SessionConfigMaxResponseOutputTokensIntImplCopyWithImpl<$Res>;
  @useResult
  $Res call({int value});
}

/// @nodoc
class __$$SessionConfigMaxResponseOutputTokensIntImplCopyWithImpl<$Res>
    extends _$SessionConfigMaxResponseOutputTokensCopyWithImpl<$Res,
        _$SessionConfigMaxResponseOutputTokensIntImpl>
    implements _$$SessionConfigMaxResponseOutputTokensIntImplCopyWith<$Res> {
  __$$SessionConfigMaxResponseOutputTokensIntImplCopyWithImpl(
      _$SessionConfigMaxResponseOutputTokensIntImpl _value,
      $Res Function(_$SessionConfigMaxResponseOutputTokensIntImpl) _then)
      : super(_value, _then);

  /// Create a copy of SessionConfigMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? value = null,
  }) {
    return _then(_$SessionConfigMaxResponseOutputTokensIntImpl(
      null == value
          ? _value.value
          : value // ignore: cast_nullable_to_non_nullable
              as int,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$SessionConfigMaxResponseOutputTokensIntImpl
    extends SessionConfigMaxResponseOutputTokensInt {
  const _$SessionConfigMaxResponseOutputTokensIntImpl(this.value,
      {final String? $type})
      : $type = $type ?? 'int',
        super._();

  factory _$SessionConfigMaxResponseOutputTokensIntImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$SessionConfigMaxResponseOutputTokensIntImplFromJson(json);

  @override
  final int value;

  @JsonKey(name: 'runtimeType')
  final String $type;

  @override
  String toString() {
    return 'SessionConfigMaxResponseOutputTokens.int(value: $value)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$SessionConfigMaxResponseOutputTokensIntImpl &&
            (identical(other.value, value) || other.value == value));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, value);

  /// Create a copy of SessionConfigMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$SessionConfigMaxResponseOutputTokensIntImplCopyWith<
          _$SessionConfigMaxResponseOutputTokensIntImpl>
      get copyWith =>
          __$$SessionConfigMaxResponseOutputTokensIntImplCopyWithImpl<
              _$SessionConfigMaxResponseOutputTokensIntImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(int value) int,
    required TResult Function(String value) string,
  }) {
    return int(value);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(int value)? int,
    TResult? Function(String value)? string,
  }) {
    return int?.call(value);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(int value)? int,
    TResult Function(String value)? string,
    required TResult orElse(),
  }) {
    if (int != null) {
      return int(value);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(SessionConfigMaxResponseOutputTokensInt value)
        int,
    required TResult Function(SessionConfigMaxResponseOutputTokensString value)
        string,
  }) {
    return int(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(SessionConfigMaxResponseOutputTokensInt value)? int,
    TResult? Function(SessionConfigMaxResponseOutputTokensString value)? string,
  }) {
    return int?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(SessionConfigMaxResponseOutputTokensInt value)? int,
    TResult Function(SessionConfigMaxResponseOutputTokensString value)? string,
    required TResult orElse(),
  }) {
    if (int != null) {
      return int(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$SessionConfigMaxResponseOutputTokensIntImplToJson(
      this,
    );
  }
}

abstract class SessionConfigMaxResponseOutputTokensInt
    extends SessionConfigMaxResponseOutputTokens {
  const factory SessionConfigMaxResponseOutputTokensInt(final int value) =
      _$SessionConfigMaxResponseOutputTokensIntImpl;
  const SessionConfigMaxResponseOutputTokensInt._() : super._();

  factory SessionConfigMaxResponseOutputTokensInt.fromJson(
          Map<String, dynamic> json) =
      _$SessionConfigMaxResponseOutputTokensIntImpl.fromJson;

  @override
  int get value;

  /// Create a copy of SessionConfigMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$SessionConfigMaxResponseOutputTokensIntImplCopyWith<
          _$SessionConfigMaxResponseOutputTokensIntImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$SessionConfigMaxResponseOutputTokensStringImplCopyWith<$Res> {
  factory _$$SessionConfigMaxResponseOutputTokensStringImplCopyWith(
          _$SessionConfigMaxResponseOutputTokensStringImpl value,
          $Res Function(_$SessionConfigMaxResponseOutputTokensStringImpl)
              then) =
      __$$SessionConfigMaxResponseOutputTokensStringImplCopyWithImpl<$Res>;
  @useResult
  $Res call({String value});
}

/// @nodoc
class __$$SessionConfigMaxResponseOutputTokensStringImplCopyWithImpl<$Res>
    extends _$SessionConfigMaxResponseOutputTokensCopyWithImpl<$Res,
        _$SessionConfigMaxResponseOutputTokensStringImpl>
    implements _$$SessionConfigMaxResponseOutputTokensStringImplCopyWith<$Res> {
  __$$SessionConfigMaxResponseOutputTokensStringImplCopyWithImpl(
      _$SessionConfigMaxResponseOutputTokensStringImpl _value,
      $Res Function(_$SessionConfigMaxResponseOutputTokensStringImpl) _then)
      : super(_value, _then);

  /// Create a copy of SessionConfigMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? value = null,
  }) {
    return _then(_$SessionConfigMaxResponseOutputTokensStringImpl(
      null == value
          ? _value.value
          : value // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$SessionConfigMaxResponseOutputTokensStringImpl
    extends SessionConfigMaxResponseOutputTokensString {
  const _$SessionConfigMaxResponseOutputTokensStringImpl(this.value,
      {final String? $type})
      : $type = $type ?? 'string',
        super._();

  factory _$SessionConfigMaxResponseOutputTokensStringImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$SessionConfigMaxResponseOutputTokensStringImplFromJson(json);

  @override
  final String value;

  @JsonKey(name: 'runtimeType')
  final String $type;

  @override
  String toString() {
    return 'SessionConfigMaxResponseOutputTokens.string(value: $value)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$SessionConfigMaxResponseOutputTokensStringImpl &&
            (identical(other.value, value) || other.value == value));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, value);

  /// Create a copy of SessionConfigMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$SessionConfigMaxResponseOutputTokensStringImplCopyWith<
          _$SessionConfigMaxResponseOutputTokensStringImpl>
      get copyWith =>
          __$$SessionConfigMaxResponseOutputTokensStringImplCopyWithImpl<
                  _$SessionConfigMaxResponseOutputTokensStringImpl>(
              this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(int value) int,
    required TResult Function(String value) string,
  }) {
    return string(value);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(int value)? int,
    TResult? Function(String value)? string,
  }) {
    return string?.call(value);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(int value)? int,
    TResult Function(String value)? string,
    required TResult orElse(),
  }) {
    if (string != null) {
      return string(value);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(SessionConfigMaxResponseOutputTokensInt value)
        int,
    required TResult Function(SessionConfigMaxResponseOutputTokensString value)
        string,
  }) {
    return string(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(SessionConfigMaxResponseOutputTokensInt value)? int,
    TResult? Function(SessionConfigMaxResponseOutputTokensString value)? string,
  }) {
    return string?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(SessionConfigMaxResponseOutputTokensInt value)? int,
    TResult Function(SessionConfigMaxResponseOutputTokensString value)? string,
    required TResult orElse(),
  }) {
    if (string != null) {
      return string(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$SessionConfigMaxResponseOutputTokensStringImplToJson(
      this,
    );
  }
}

abstract class SessionConfigMaxResponseOutputTokensString
    extends SessionConfigMaxResponseOutputTokens {
  const factory SessionConfigMaxResponseOutputTokensString(final String value) =
      _$SessionConfigMaxResponseOutputTokensStringImpl;
  const SessionConfigMaxResponseOutputTokensString._() : super._();

  factory SessionConfigMaxResponseOutputTokensString.fromJson(
          Map<String, dynamic> json) =
      _$SessionConfigMaxResponseOutputTokensStringImpl.fromJson;

  @override
  String get value;

  /// Create a copy of SessionConfigMaxResponseOutputTokens
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$SessionConfigMaxResponseOutputTokensStringImplCopyWith<
          _$SessionConfigMaxResponseOutputTokensStringImpl>
      get copyWith => throw _privateConstructorUsedError;
}

Conversation _$ConversationFromJson(Map<String, dynamic> json) {
  return _Conversation.fromJson(json);
}

/// @nodoc
mixin _$Conversation {
  /// The unique ID of the conversation.
  String get id => throw _privateConstructorUsedError;

  /// The object type, must be "realtime.conversation".
  ObjectType get object => throw _privateConstructorUsedError;

  /// Serializes this Conversation to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of Conversation
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $ConversationCopyWith<Conversation> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $ConversationCopyWith<$Res> {
  factory $ConversationCopyWith(
          Conversation value, $Res Function(Conversation) then) =
      _$ConversationCopyWithImpl<$Res, Conversation>;
  @useResult
  $Res call({String id, ObjectType object});
}

/// @nodoc
class _$ConversationCopyWithImpl<$Res, $Val extends Conversation>
    implements $ConversationCopyWith<$Res> {
  _$ConversationCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of Conversation
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? id = null,
    Object? object = null,
  }) {
    return _then(_value.copyWith(
      id: null == id
          ? _value.id
          : id // ignore: cast_nullable_to_non_nullable
              as String,
      object: null == object
          ? _value.object
          : object // ignore: cast_nullable_to_non_nullable
              as ObjectType,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$ConversationImplCopyWith<$Res>
    implements $ConversationCopyWith<$Res> {
  factory _$$ConversationImplCopyWith(
          _$ConversationImpl value, $Res Function(_$ConversationImpl) then) =
      __$$ConversationImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call({String id, ObjectType object});
}

/// @nodoc
class __$$ConversationImplCopyWithImpl<$Res>
    extends _$ConversationCopyWithImpl<$Res, _$ConversationImpl>
    implements _$$ConversationImplCopyWith<$Res> {
  __$$ConversationImplCopyWithImpl(
      _$ConversationImpl _value, $Res Function(_$ConversationImpl) _then)
      : super(_value, _then);

  /// Create a copy of Conversation
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? id = null,
    Object? object = null,
  }) {
    return _then(_$ConversationImpl(
      id: null == id
          ? _value.id
          : id // ignore: cast_nullable_to_non_nullable
              as String,
      object: null == object
          ? _value.object
          : object // ignore: cast_nullable_to_non_nullable
              as ObjectType,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ConversationImpl extends _Conversation {
  const _$ConversationImpl(
      {required this.id, this.object = ObjectType.realtimeConversation})
      : super._();

  factory _$ConversationImpl.fromJson(Map<String, dynamic> json) =>
      _$$ConversationImplFromJson(json);

  /// The unique ID of the conversation.
  @override
  final String id;

  /// The object type, must be "realtime.conversation".
  @override
  @JsonKey()
  final ObjectType object;

  @override
  String toString() {
    return 'Conversation(id: $id, object: $object)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ConversationImpl &&
            (identical(other.id, id) || other.id == id) &&
            (identical(other.object, object) || other.object == object));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, id, object);

  /// Create a copy of Conversation
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ConversationImplCopyWith<_$ConversationImpl> get copyWith =>
      __$$ConversationImplCopyWithImpl<_$ConversationImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$ConversationImplToJson(
      this,
    );
  }
}

abstract class _Conversation extends Conversation {
  const factory _Conversation(
      {required final String id, final ObjectType object}) = _$ConversationImpl;
  const _Conversation._() : super._();

  factory _Conversation.fromJson(Map<String, dynamic> json) =
      _$ConversationImpl.fromJson;

  /// The unique ID of the conversation.
  @override
  String get id;

  /// The object type, must be "realtime.conversation".
  @override
  ObjectType get object;

  /// Create a copy of Conversation
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ConversationImplCopyWith<_$ConversationImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

Delta _$DeltaFromJson(Map<String, dynamic> json) {
  return _Delta.fromJson(json);
}

/// @nodoc
mixin _$Delta {
  /// The transcript of the audio.
  @JsonKey(includeIfNull: false)
  String? get transcript => throw _privateConstructorUsedError;

  /// The audio bytes.
  @Uint8ListConverter()
  @JsonKey(includeIfNull: false)
  Uint8List? get audio => throw _privateConstructorUsedError;

  /// The text.
  @JsonKey(includeIfNull: false)
  String? get text => throw _privateConstructorUsedError;

  /// The arguments.
  @JsonKey(includeIfNull: false)
  String? get arguments => throw _privateConstructorUsedError;

  /// Serializes this Delta to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of Delta
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $DeltaCopyWith<Delta> get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $DeltaCopyWith<$Res> {
  factory $DeltaCopyWith(Delta value, $Res Function(Delta) then) =
      _$DeltaCopyWithImpl<$Res, Delta>;
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) String? transcript,
      @Uint8ListConverter() @JsonKey(includeIfNull: false) Uint8List? audio,
      @JsonKey(includeIfNull: false) String? text,
      @JsonKey(includeIfNull: false) String? arguments});
}

/// @nodoc
class _$DeltaCopyWithImpl<$Res, $Val extends Delta>
    implements $DeltaCopyWith<$Res> {
  _$DeltaCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of Delta
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? transcript = freezed,
    Object? audio = freezed,
    Object? text = freezed,
    Object? arguments = freezed,
  }) {
    return _then(_value.copyWith(
      transcript: freezed == transcript
          ? _value.transcript
          : transcript // ignore: cast_nullable_to_non_nullable
              as String?,
      audio: freezed == audio
          ? _value.audio
          : audio // ignore: cast_nullable_to_non_nullable
              as Uint8List?,
      text: freezed == text
          ? _value.text
          : text // ignore: cast_nullable_to_non_nullable
              as String?,
      arguments: freezed == arguments
          ? _value.arguments
          : arguments // ignore: cast_nullable_to_non_nullable
              as String?,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$DeltaImplCopyWith<$Res> implements $DeltaCopyWith<$Res> {
  factory _$$DeltaImplCopyWith(
          _$DeltaImpl value, $Res Function(_$DeltaImpl) then) =
      __$$DeltaImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) String? transcript,
      @Uint8ListConverter() @JsonKey(includeIfNull: false) Uint8List? audio,
      @JsonKey(includeIfNull: false) String? text,
      @JsonKey(includeIfNull: false) String? arguments});
}

/// @nodoc
class __$$DeltaImplCopyWithImpl<$Res>
    extends _$DeltaCopyWithImpl<$Res, _$DeltaImpl>
    implements _$$DeltaImplCopyWith<$Res> {
  __$$DeltaImplCopyWithImpl(
      _$DeltaImpl _value, $Res Function(_$DeltaImpl) _then)
      : super(_value, _then);

  /// Create a copy of Delta
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? transcript = freezed,
    Object? audio = freezed,
    Object? text = freezed,
    Object? arguments = freezed,
  }) {
    return _then(_$DeltaImpl(
      transcript: freezed == transcript
          ? _value.transcript
          : transcript // ignore: cast_nullable_to_non_nullable
              as String?,
      audio: freezed == audio
          ? _value.audio
          : audio // ignore: cast_nullable_to_non_nullable
              as Uint8List?,
      text: freezed == text
          ? _value.text
          : text // ignore: cast_nullable_to_non_nullable
              as String?,
      arguments: freezed == arguments
          ? _value.arguments
          : arguments // ignore: cast_nullable_to_non_nullable
              as String?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$DeltaImpl extends _Delta {
  const _$DeltaImpl(
      {@JsonKey(includeIfNull: false) this.transcript,
      @Uint8ListConverter() @JsonKey(includeIfNull: false) this.audio,
      @JsonKey(includeIfNull: false) this.text,
      @JsonKey(includeIfNull: false) this.arguments})
      : super._();

  factory _$DeltaImpl.fromJson(Map<String, dynamic> json) =>
      _$$DeltaImplFromJson(json);

  /// The transcript of the audio.
  @override
  @JsonKey(includeIfNull: false)
  final String? transcript;

  /// The audio bytes.
  @override
  @Uint8ListConverter()
  @JsonKey(includeIfNull: false)
  final Uint8List? audio;

  /// The text.
  @override
  @JsonKey(includeIfNull: false)
  final String? text;

  /// The arguments.
  @override
  @JsonKey(includeIfNull: false)
  final String? arguments;

  @override
  String toString() {
    return 'Delta(transcript: $transcript, audio: $audio, text: $text, arguments: $arguments)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$DeltaImpl &&
            (identical(other.transcript, transcript) ||
                other.transcript == transcript) &&
            const DeepCollectionEquality().equals(other.audio, audio) &&
            (identical(other.text, text) || other.text == text) &&
            (identical(other.arguments, arguments) ||
                other.arguments == arguments));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, transcript,
      const DeepCollectionEquality().hash(audio), text, arguments);

  /// Create a copy of Delta
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$DeltaImplCopyWith<_$DeltaImpl> get copyWith =>
      __$$DeltaImplCopyWithImpl<_$DeltaImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$DeltaImplToJson(
      this,
    );
  }
}

abstract class _Delta extends Delta {
  const factory _Delta(
      {@JsonKey(includeIfNull: false) final String? transcript,
      @Uint8ListConverter()
      @JsonKey(includeIfNull: false)
      final Uint8List? audio,
      @JsonKey(includeIfNull: false) final String? text,
      @JsonKey(includeIfNull: false) final String? arguments}) = _$DeltaImpl;
  const _Delta._() : super._();

  factory _Delta.fromJson(Map<String, dynamic> json) = _$DeltaImpl.fromJson;

  /// The transcript of the audio.
  @override
  @JsonKey(includeIfNull: false)
  String? get transcript;

  /// The audio bytes.
  @override
  @Uint8ListConverter()
  @JsonKey(includeIfNull: false)
  Uint8List? get audio;

  /// The text.
  @override
  @JsonKey(includeIfNull: false)
  String? get text;

  /// The arguments.
  @override
  @JsonKey(includeIfNull: false)
  String? get arguments;

  /// Create a copy of Delta
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$DeltaImplCopyWith<_$DeltaImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

FormattedTool _$FormattedToolFromJson(Map<String, dynamic> json) {
  return _FormattedTool.fromJson(json);
}

/// @nodoc
mixin _$FormattedTool {
  /// The type of the tool. Currently, only `function` is supported.
  ToolType get type => throw _privateConstructorUsedError;

  /// The name of the function.
  String get name => throw _privateConstructorUsedError;

  /// The call id.
  @JsonKey(name: 'call_id')
  String get callId => throw _privateConstructorUsedError;

  /// The arguments.
  String get arguments => throw _privateConstructorUsedError;

  /// Serializes this FormattedTool to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of FormattedTool
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $FormattedToolCopyWith<FormattedTool> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $FormattedToolCopyWith<$Res> {
  factory $FormattedToolCopyWith(
          FormattedTool value, $Res Function(FormattedTool) then) =
      _$FormattedToolCopyWithImpl<$Res, FormattedTool>;
  @useResult
  $Res call(
      {ToolType type,
      String name,
      @JsonKey(name: 'call_id') String callId,
      String arguments});
}

/// @nodoc
class _$FormattedToolCopyWithImpl<$Res, $Val extends FormattedTool>
    implements $FormattedToolCopyWith<$Res> {
  _$FormattedToolCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of FormattedTool
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? name = null,
    Object? callId = null,
    Object? arguments = null,
  }) {
    return _then(_value.copyWith(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ToolType,
      name: null == name
          ? _value.name
          : name // ignore: cast_nullable_to_non_nullable
              as String,
      callId: null == callId
          ? _value.callId
          : callId // ignore: cast_nullable_to_non_nullable
              as String,
      arguments: null == arguments
          ? _value.arguments
          : arguments // ignore: cast_nullable_to_non_nullable
              as String,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$FormattedToolImplCopyWith<$Res>
    implements $FormattedToolCopyWith<$Res> {
  factory _$$FormattedToolImplCopyWith(
          _$FormattedToolImpl value, $Res Function(_$FormattedToolImpl) then) =
      __$$FormattedToolImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {ToolType type,
      String name,
      @JsonKey(name: 'call_id') String callId,
      String arguments});
}

/// @nodoc
class __$$FormattedToolImplCopyWithImpl<$Res>
    extends _$FormattedToolCopyWithImpl<$Res, _$FormattedToolImpl>
    implements _$$FormattedToolImplCopyWith<$Res> {
  __$$FormattedToolImplCopyWithImpl(
      _$FormattedToolImpl _value, $Res Function(_$FormattedToolImpl) _then)
      : super(_value, _then);

  /// Create a copy of FormattedTool
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? name = null,
    Object? callId = null,
    Object? arguments = null,
  }) {
    return _then(_$FormattedToolImpl(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ToolType,
      name: null == name
          ? _value.name
          : name // ignore: cast_nullable_to_non_nullable
              as String,
      callId: null == callId
          ? _value.callId
          : callId // ignore: cast_nullable_to_non_nullable
              as String,
      arguments: null == arguments
          ? _value.arguments
          : arguments // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$FormattedToolImpl extends _FormattedTool {
  const _$FormattedToolImpl(
      {this.type = ToolType.function,
      required this.name,
      @JsonKey(name: 'call_id') required this.callId,
      required this.arguments})
      : super._();

  factory _$FormattedToolImpl.fromJson(Map<String, dynamic> json) =>
      _$$FormattedToolImplFromJson(json);

  /// The type of the tool. Currently, only `function` is supported.
  @override
  @JsonKey()
  final ToolType type;

  /// The name of the function.
  @override
  final String name;

  /// The call id.
  @override
  @JsonKey(name: 'call_id')
  final String callId;

  /// The arguments.
  @override
  final String arguments;

  @override
  String toString() {
    return 'FormattedTool(type: $type, name: $name, callId: $callId, arguments: $arguments)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$FormattedToolImpl &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.name, name) || other.name == name) &&
            (identical(other.callId, callId) || other.callId == callId) &&
            (identical(other.arguments, arguments) ||
                other.arguments == arguments));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, type, name, callId, arguments);

  /// Create a copy of FormattedTool
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$FormattedToolImplCopyWith<_$FormattedToolImpl> get copyWith =>
      __$$FormattedToolImplCopyWithImpl<_$FormattedToolImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$FormattedToolImplToJson(
      this,
    );
  }
}

abstract class _FormattedTool extends FormattedTool {
  const factory _FormattedTool(
      {final ToolType type,
      required final String name,
      @JsonKey(name: 'call_id') required final String callId,
      required final String arguments}) = _$FormattedToolImpl;
  const _FormattedTool._() : super._();

  factory _FormattedTool.fromJson(Map<String, dynamic> json) =
      _$FormattedToolImpl.fromJson;

  /// The type of the tool. Currently, only `function` is supported.
  @override
  ToolType get type;

  /// The name of the function.
  @override
  String get name;

  /// The call id.
  @override
  @JsonKey(name: 'call_id')
  String get callId;

  /// The arguments.
  @override
  String get arguments;

  /// Create a copy of FormattedTool
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$FormattedToolImplCopyWith<_$FormattedToolImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

FormattedProperty _$FormattedPropertyFromJson(Map<String, dynamic> json) {
  return _FormattedProperty.fromJson(json);
}

/// @nodoc
mixin _$FormattedProperty {
  /// The audio bytes.
  @Uint8ListConverter()
  Uint8List get audio => throw _privateConstructorUsedError;

  /// The text.
  String get text => throw _privateConstructorUsedError;

  /// The transcript.
  String get transcript => throw _privateConstructorUsedError;

  /// A formatted tool.
  @JsonKey(includeIfNull: false)
  FormattedTool? get tool => throw _privateConstructorUsedError;

  /// The output.
  @JsonKey(includeIfNull: false)
  String? get output => throw _privateConstructorUsedError;

  /// Serializes this FormattedProperty to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of FormattedProperty
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $FormattedPropertyCopyWith<FormattedProperty> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $FormattedPropertyCopyWith<$Res> {
  factory $FormattedPropertyCopyWith(
          FormattedProperty value, $Res Function(FormattedProperty) then) =
      _$FormattedPropertyCopyWithImpl<$Res, FormattedProperty>;
  @useResult
  $Res call(
      {@Uint8ListConverter() Uint8List audio,
      String text,
      String transcript,
      @JsonKey(includeIfNull: false) FormattedTool? tool,
      @JsonKey(includeIfNull: false) String? output});

  $FormattedToolCopyWith<$Res>? get tool;
}

/// @nodoc
class _$FormattedPropertyCopyWithImpl<$Res, $Val extends FormattedProperty>
    implements $FormattedPropertyCopyWith<$Res> {
  _$FormattedPropertyCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of FormattedProperty
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? audio = null,
    Object? text = null,
    Object? transcript = null,
    Object? tool = freezed,
    Object? output = freezed,
  }) {
    return _then(_value.copyWith(
      audio: null == audio
          ? _value.audio
          : audio // ignore: cast_nullable_to_non_nullable
              as Uint8List,
      text: null == text
          ? _value.text
          : text // ignore: cast_nullable_to_non_nullable
              as String,
      transcript: null == transcript
          ? _value.transcript
          : transcript // ignore: cast_nullable_to_non_nullable
              as String,
      tool: freezed == tool
          ? _value.tool
          : tool // ignore: cast_nullable_to_non_nullable
              as FormattedTool?,
      output: freezed == output
          ? _value.output
          : output // ignore: cast_nullable_to_non_nullable
              as String?,
    ) as $Val);
  }

  /// Create a copy of FormattedProperty
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $FormattedToolCopyWith<$Res>? get tool {
    if (_value.tool == null) {
      return null;
    }

    return $FormattedToolCopyWith<$Res>(_value.tool!, (value) {
      return _then(_value.copyWith(tool: value) as $Val);
    });
  }
}

/// @nodoc
abstract class _$$FormattedPropertyImplCopyWith<$Res>
    implements $FormattedPropertyCopyWith<$Res> {
  factory _$$FormattedPropertyImplCopyWith(_$FormattedPropertyImpl value,
          $Res Function(_$FormattedPropertyImpl) then) =
      __$$FormattedPropertyImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@Uint8ListConverter() Uint8List audio,
      String text,
      String transcript,
      @JsonKey(includeIfNull: false) FormattedTool? tool,
      @JsonKey(includeIfNull: false) String? output});

  @override
  $FormattedToolCopyWith<$Res>? get tool;
}

/// @nodoc
class __$$FormattedPropertyImplCopyWithImpl<$Res>
    extends _$FormattedPropertyCopyWithImpl<$Res, _$FormattedPropertyImpl>
    implements _$$FormattedPropertyImplCopyWith<$Res> {
  __$$FormattedPropertyImplCopyWithImpl(_$FormattedPropertyImpl _value,
      $Res Function(_$FormattedPropertyImpl) _then)
      : super(_value, _then);

  /// Create a copy of FormattedProperty
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? audio = null,
    Object? text = null,
    Object? transcript = null,
    Object? tool = freezed,
    Object? output = freezed,
  }) {
    return _then(_$FormattedPropertyImpl(
      audio: null == audio
          ? _value.audio
          : audio // ignore: cast_nullable_to_non_nullable
              as Uint8List,
      text: null == text
          ? _value.text
          : text // ignore: cast_nullable_to_non_nullable
              as String,
      transcript: null == transcript
          ? _value.transcript
          : transcript // ignore: cast_nullable_to_non_nullable
              as String,
      tool: freezed == tool
          ? _value.tool
          : tool // ignore: cast_nullable_to_non_nullable
              as FormattedTool?,
      output: freezed == output
          ? _value.output
          : output // ignore: cast_nullable_to_non_nullable
              as String?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$FormattedPropertyImpl extends _FormattedProperty {
  const _$FormattedPropertyImpl(
      {@Uint8ListConverter() required this.audio,
      required this.text,
      required this.transcript,
      @JsonKey(includeIfNull: false) this.tool,
      @JsonKey(includeIfNull: false) this.output})
      : super._();

  factory _$FormattedPropertyImpl.fromJson(Map<String, dynamic> json) =>
      _$$FormattedPropertyImplFromJson(json);

  /// The audio bytes.
  @override
  @Uint8ListConverter()
  final Uint8List audio;

  /// The text.
  @override
  final String text;

  /// The transcript.
  @override
  final String transcript;

  /// A formatted tool.
  @override
  @JsonKey(includeIfNull: false)
  final FormattedTool? tool;

  /// The output.
  @override
  @JsonKey(includeIfNull: false)
  final String? output;

  @override
  String toString() {
    return 'FormattedProperty(audio: $audio, text: $text, transcript: $transcript, tool: $tool, output: $output)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$FormattedPropertyImpl &&
            const DeepCollectionEquality().equals(other.audio, audio) &&
            (identical(other.text, text) || other.text == text) &&
            (identical(other.transcript, transcript) ||
                other.transcript == transcript) &&
            (identical(other.tool, tool) || other.tool == tool) &&
            (identical(other.output, output) || other.output == output));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(
      runtimeType,
      const DeepCollectionEquality().hash(audio),
      text,
      transcript,
      tool,
      output);

  /// Create a copy of FormattedProperty
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$FormattedPropertyImplCopyWith<_$FormattedPropertyImpl> get copyWith =>
      __$$FormattedPropertyImplCopyWithImpl<_$FormattedPropertyImpl>(
          this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$FormattedPropertyImplToJson(
      this,
    );
  }
}

abstract class _FormattedProperty extends FormattedProperty {
  const factory _FormattedProperty(
          {@Uint8ListConverter() required final Uint8List audio,
          required final String text,
          required final String transcript,
          @JsonKey(includeIfNull: false) final FormattedTool? tool,
          @JsonKey(includeIfNull: false) final String? output}) =
      _$FormattedPropertyImpl;
  const _FormattedProperty._() : super._();

  factory _FormattedProperty.fromJson(Map<String, dynamic> json) =
      _$FormattedPropertyImpl.fromJson;

  /// The audio bytes.
  @override
  @Uint8ListConverter()
  Uint8List get audio;

  /// The text.
  @override
  String get text;

  /// The transcript.
  @override
  String get transcript;

  /// A formatted tool.
  @override
  @JsonKey(includeIfNull: false)
  FormattedTool? get tool;

  /// The output.
  @override
  @JsonKey(includeIfNull: false)
  String? get output;

  /// Create a copy of FormattedProperty
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$FormattedPropertyImplCopyWith<_$FormattedPropertyImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

FormattedItem _$FormattedItemFromJson(Map<String, dynamic> json) {
  return _FormattedItem.fromJson(json);
}

/// @nodoc
mixin _$FormattedItem {
  /// The item to add to the conversation.
  /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput]
  Item get item => throw _privateConstructorUsedError;

  /// A formatted property.
  FormattedProperty? get formatted => throw _privateConstructorUsedError;

  /// Serializes this FormattedItem to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of FormattedItem
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $FormattedItemCopyWith<FormattedItem> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $FormattedItemCopyWith<$Res> {
  factory $FormattedItemCopyWith(
          FormattedItem value, $Res Function(FormattedItem) then) =
      _$FormattedItemCopyWithImpl<$Res, FormattedItem>;
  @useResult
  $Res call({Item item, FormattedProperty? formatted});

  $ItemCopyWith<$Res> get item;
  $FormattedPropertyCopyWith<$Res>? get formatted;
}

/// @nodoc
class _$FormattedItemCopyWithImpl<$Res, $Val extends FormattedItem>
    implements $FormattedItemCopyWith<$Res> {
  _$FormattedItemCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of FormattedItem
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? item = null,
    Object? formatted = freezed,
  }) {
    return _then(_value.copyWith(
      item: null == item
          ? _value.item
          : item // ignore: cast_nullable_to_non_nullable
              as Item,
      formatted: freezed == formatted
          ? _value.formatted
          : formatted // ignore: cast_nullable_to_non_nullable
              as FormattedProperty?,
    ) as $Val);
  }

  /// Create a copy of FormattedItem
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ItemCopyWith<$Res> get item {
    return $ItemCopyWith<$Res>(_value.item, (value) {
      return _then(_value.copyWith(item: value) as $Val);
    });
  }

  /// Create a copy of FormattedItem
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $FormattedPropertyCopyWith<$Res>? get formatted {
    if (_value.formatted == null) {
      return null;
    }

    return $FormattedPropertyCopyWith<$Res>(_value.formatted!, (value) {
      return _then(_value.copyWith(formatted: value) as $Val);
    });
  }
}

/// @nodoc
abstract class _$$FormattedItemImplCopyWith<$Res>
    implements $FormattedItemCopyWith<$Res> {
  factory _$$FormattedItemImplCopyWith(
          _$FormattedItemImpl value, $Res Function(_$FormattedItemImpl) then) =
      __$$FormattedItemImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call({Item item, FormattedProperty? formatted});

  @override
  $ItemCopyWith<$Res> get item;
  @override
  $FormattedPropertyCopyWith<$Res>? get formatted;
}

/// @nodoc
class __$$FormattedItemImplCopyWithImpl<$Res>
    extends _$FormattedItemCopyWithImpl<$Res, _$FormattedItemImpl>
    implements _$$FormattedItemImplCopyWith<$Res> {
  __$$FormattedItemImplCopyWithImpl(
      _$FormattedItemImpl _value, $Res Function(_$FormattedItemImpl) _then)
      : super(_value, _then);

  /// Create a copy of FormattedItem
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? item = null,
    Object? formatted = freezed,
  }) {
    return _then(_$FormattedItemImpl(
      item: null == item
          ? _value.item
          : item // ignore: cast_nullable_to_non_nullable
              as Item,
      formatted: freezed == formatted
          ? _value.formatted
          : formatted // ignore: cast_nullable_to_non_nullable
              as FormattedProperty?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$FormattedItemImpl extends _FormattedItem {
  const _$FormattedItemImpl({required this.item, required this.formatted})
      : super._();

  factory _$FormattedItemImpl.fromJson(Map<String, dynamic> json) =>
      _$$FormattedItemImplFromJson(json);

  /// The item to add to the conversation.
  /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput]
  @override
  final Item item;

  /// A formatted property.
  @override
  final FormattedProperty? formatted;

  @override
  String toString() {
    return 'FormattedItem(item: $item, formatted: $formatted)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$FormattedItemImpl &&
            (identical(other.item, item) || other.item == item) &&
            (identical(other.formatted, formatted) ||
                other.formatted == formatted));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, item, formatted);

  /// Create a copy of FormattedItem
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$FormattedItemImplCopyWith<_$FormattedItemImpl> get copyWith =>
      __$$FormattedItemImplCopyWithImpl<_$FormattedItemImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$FormattedItemImplToJson(
      this,
    );
  }
}

abstract class _FormattedItem extends FormattedItem {
  const factory _FormattedItem(
      {required final Item item,
      required final FormattedProperty? formatted}) = _$FormattedItemImpl;
  const _FormattedItem._() : super._();

  factory _FormattedItem.fromJson(Map<String, dynamic> json) =
      _$FormattedItemImpl.fromJson;

  /// The item to add to the conversation.
  /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput]
  @override
  Item get item;

  /// A formatted property.
  @override
  FormattedProperty? get formatted;

  /// Create a copy of FormattedItem
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$FormattedItemImplCopyWith<_$FormattedItemImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

ItemSpeech _$ItemSpeechFromJson(Map<String, dynamic> json) {
  return _ItemSpeech.fromJson(json);
}

/// @nodoc
mixin _$ItemSpeech {
  /// The start time of the audio in milliseconds.
  int get audioStartMs => throw _privateConstructorUsedError;

  /// The end time of the audio in milliseconds.
  @JsonKey(includeIfNull: false)
  int? get audioEndMs => throw _privateConstructorUsedError;

  /// The audio bytes.
  @Uint8ListConverter()
  @JsonKey(includeIfNull: false)
  Uint8List? get audio => throw _privateConstructorUsedError;

  /// Serializes this ItemSpeech to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of ItemSpeech
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $ItemSpeechCopyWith<ItemSpeech> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $ItemSpeechCopyWith<$Res> {
  factory $ItemSpeechCopyWith(
          ItemSpeech value, $Res Function(ItemSpeech) then) =
      _$ItemSpeechCopyWithImpl<$Res, ItemSpeech>;
  @useResult
  $Res call(
      {int audioStartMs,
      @JsonKey(includeIfNull: false) int? audioEndMs,
      @Uint8ListConverter() @JsonKey(includeIfNull: false) Uint8List? audio});
}

/// @nodoc
class _$ItemSpeechCopyWithImpl<$Res, $Val extends ItemSpeech>
    implements $ItemSpeechCopyWith<$Res> {
  _$ItemSpeechCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of ItemSpeech
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? audioStartMs = null,
    Object? audioEndMs = freezed,
    Object? audio = freezed,
  }) {
    return _then(_value.copyWith(
      audioStartMs: null == audioStartMs
          ? _value.audioStartMs
          : audioStartMs // ignore: cast_nullable_to_non_nullable
              as int,
      audioEndMs: freezed == audioEndMs
          ? _value.audioEndMs
          : audioEndMs // ignore: cast_nullable_to_non_nullable
              as int?,
      audio: freezed == audio
          ? _value.audio
          : audio // ignore: cast_nullable_to_non_nullable
              as Uint8List?,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$ItemSpeechImplCopyWith<$Res>
    implements $ItemSpeechCopyWith<$Res> {
  factory _$$ItemSpeechImplCopyWith(
          _$ItemSpeechImpl value, $Res Function(_$ItemSpeechImpl) then) =
      __$$ItemSpeechImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {int audioStartMs,
      @JsonKey(includeIfNull: false) int? audioEndMs,
      @Uint8ListConverter() @JsonKey(includeIfNull: false) Uint8List? audio});
}

/// @nodoc
class __$$ItemSpeechImplCopyWithImpl<$Res>
    extends _$ItemSpeechCopyWithImpl<$Res, _$ItemSpeechImpl>
    implements _$$ItemSpeechImplCopyWith<$Res> {
  __$$ItemSpeechImplCopyWithImpl(
      _$ItemSpeechImpl _value, $Res Function(_$ItemSpeechImpl) _then)
      : super(_value, _then);

  /// Create a copy of ItemSpeech
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? audioStartMs = null,
    Object? audioEndMs = freezed,
    Object? audio = freezed,
  }) {
    return _then(_$ItemSpeechImpl(
      audioStartMs: null == audioStartMs
          ? _value.audioStartMs
          : audioStartMs // ignore: cast_nullable_to_non_nullable
              as int,
      audioEndMs: freezed == audioEndMs
          ? _value.audioEndMs
          : audioEndMs // ignore: cast_nullable_to_non_nullable
              as int?,
      audio: freezed == audio
          ? _value.audio
          : audio // ignore: cast_nullable_to_non_nullable
              as Uint8List?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ItemSpeechImpl extends _ItemSpeech {
  const _$ItemSpeechImpl(
      {required this.audioStartMs,
      @JsonKey(includeIfNull: false) this.audioEndMs,
      @Uint8ListConverter() @JsonKey(includeIfNull: false) this.audio})
      : super._();

  factory _$ItemSpeechImpl.fromJson(Map<String, dynamic> json) =>
      _$$ItemSpeechImplFromJson(json);

  /// The start time of the audio in milliseconds.
  @override
  final int audioStartMs;

  /// The end time of the audio in milliseconds.
  @override
  @JsonKey(includeIfNull: false)
  final int? audioEndMs;

  /// The audio bytes.
  @override
  @Uint8ListConverter()
  @JsonKey(includeIfNull: false)
  final Uint8List? audio;

  @override
  String toString() {
    return 'ItemSpeech(audioStartMs: $audioStartMs, audioEndMs: $audioEndMs, audio: $audio)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ItemSpeechImpl &&
            (identical(other.audioStartMs, audioStartMs) ||
                other.audioStartMs == audioStartMs) &&
            (identical(other.audioEndMs, audioEndMs) ||
                other.audioEndMs == audioEndMs) &&
            const DeepCollectionEquality().equals(other.audio, audio));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, audioStartMs, audioEndMs,
      const DeepCollectionEquality().hash(audio));

  /// Create a copy of ItemSpeech
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ItemSpeechImplCopyWith<_$ItemSpeechImpl> get copyWith =>
      __$$ItemSpeechImplCopyWithImpl<_$ItemSpeechImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$ItemSpeechImplToJson(
      this,
    );
  }
}

abstract class _ItemSpeech extends ItemSpeech {
  const factory _ItemSpeech(
      {required final int audioStartMs,
      @JsonKey(includeIfNull: false) final int? audioEndMs,
      @Uint8ListConverter()
      @JsonKey(includeIfNull: false)
      final Uint8List? audio}) = _$ItemSpeechImpl;
  const _ItemSpeech._() : super._();

  factory _ItemSpeech.fromJson(Map<String, dynamic> json) =
      _$ItemSpeechImpl.fromJson;

  /// The start time of the audio in milliseconds.
  @override
  int get audioStartMs;

  /// The end time of the audio in milliseconds.
  @override
  @JsonKey(includeIfNull: false)
  int? get audioEndMs;

  /// The audio bytes.
  @override
  @Uint8ListConverter()
  @JsonKey(includeIfNull: false)
  Uint8List? get audio;

  /// Create a copy of ItemSpeech
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ItemSpeechImplCopyWith<_$ItemSpeechImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

ItemTranscript _$ItemTranscriptFromJson(Map<String, dynamic> json) {
  return _ItemTranscript.fromJson(json);
}

/// @nodoc
mixin _$ItemTranscript {
  /// The transcript.
  String get transcript => throw _privateConstructorUsedError;

  /// Serializes this ItemTranscript to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of ItemTranscript
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $ItemTranscriptCopyWith<ItemTranscript> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $ItemTranscriptCopyWith<$Res> {
  factory $ItemTranscriptCopyWith(
          ItemTranscript value, $Res Function(ItemTranscript) then) =
      _$ItemTranscriptCopyWithImpl<$Res, ItemTranscript>;
  @useResult
  $Res call({String transcript});
}

/// @nodoc
class _$ItemTranscriptCopyWithImpl<$Res, $Val extends ItemTranscript>
    implements $ItemTranscriptCopyWith<$Res> {
  _$ItemTranscriptCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of ItemTranscript
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? transcript = null,
  }) {
    return _then(_value.copyWith(
      transcript: null == transcript
          ? _value.transcript
          : transcript // ignore: cast_nullable_to_non_nullable
              as String,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$ItemTranscriptImplCopyWith<$Res>
    implements $ItemTranscriptCopyWith<$Res> {
  factory _$$ItemTranscriptImplCopyWith(_$ItemTranscriptImpl value,
          $Res Function(_$ItemTranscriptImpl) then) =
      __$$ItemTranscriptImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call({String transcript});
}

/// @nodoc
class __$$ItemTranscriptImplCopyWithImpl<$Res>
    extends _$ItemTranscriptCopyWithImpl<$Res, _$ItemTranscriptImpl>
    implements _$$ItemTranscriptImplCopyWith<$Res> {
  __$$ItemTranscriptImplCopyWithImpl(
      _$ItemTranscriptImpl _value, $Res Function(_$ItemTranscriptImpl) _then)
      : super(_value, _then);

  /// Create a copy of ItemTranscript
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? transcript = null,
  }) {
    return _then(_$ItemTranscriptImpl(
      transcript: null == transcript
          ? _value.transcript
          : transcript // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ItemTranscriptImpl extends _ItemTranscript {
  const _$ItemTranscriptImpl({required this.transcript}) : super._();

  factory _$ItemTranscriptImpl.fromJson(Map<String, dynamic> json) =>
      _$$ItemTranscriptImplFromJson(json);

  /// The transcript.
  @override
  final String transcript;

  @override
  String toString() {
    return 'ItemTranscript(transcript: $transcript)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ItemTranscriptImpl &&
            (identical(other.transcript, transcript) ||
                other.transcript == transcript));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, transcript);

  /// Create a copy of ItemTranscript
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ItemTranscriptImplCopyWith<_$ItemTranscriptImpl> get copyWith =>
      __$$ItemTranscriptImplCopyWithImpl<_$ItemTranscriptImpl>(
          this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$ItemTranscriptImplToJson(
      this,
    );
  }
}

abstract class _ItemTranscript extends ItemTranscript {
  const factory _ItemTranscript({required final String transcript}) =
      _$ItemTranscriptImpl;
  const _ItemTranscript._() : super._();

  factory _ItemTranscript.fromJson(Map<String, dynamic> json) =
      _$ItemTranscriptImpl.fromJson;

  /// The transcript.
  @override
  String get transcript;

  /// Create a copy of ItemTranscript
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ItemTranscriptImplCopyWith<_$ItemTranscriptImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

EventHandlerResult _$EventHandlerResultFromJson(Map<String, dynamic> json) {
  return _EventHandlerResult.fromJson(json);
}

/// @nodoc
mixin _$EventHandlerResult {
  /// A formatted item.
  @JsonKey(includeIfNull: false)
  FormattedItem? get item => throw _privateConstructorUsedError;

  /// Delta object.
  @JsonKey(includeIfNull: false)
  Delta? get delta => throw _privateConstructorUsedError;

  /// The response resource.
  @JsonKey(includeIfNull: false)
  Response? get response => throw _privateConstructorUsedError;

  /// Serializes this EventHandlerResult to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of EventHandlerResult
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $EventHandlerResultCopyWith<EventHandlerResult> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $EventHandlerResultCopyWith<$Res> {
  factory $EventHandlerResultCopyWith(
          EventHandlerResult value, $Res Function(EventHandlerResult) then) =
      _$EventHandlerResultCopyWithImpl<$Res, EventHandlerResult>;
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) FormattedItem? item,
      @JsonKey(includeIfNull: false) Delta? delta,
      @JsonKey(includeIfNull: false) Response? response});

  $FormattedItemCopyWith<$Res>? get item;
  $DeltaCopyWith<$Res>? get delta;
  $ResponseCopyWith<$Res>? get response;
}

/// @nodoc
class _$EventHandlerResultCopyWithImpl<$Res, $Val extends EventHandlerResult>
    implements $EventHandlerResultCopyWith<$Res> {
  _$EventHandlerResultCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of EventHandlerResult
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? item = freezed,
    Object? delta = freezed,
    Object? response = freezed,
  }) {
    return _then(_value.copyWith(
      item: freezed == item
          ? _value.item
          : item // ignore: cast_nullable_to_non_nullable
              as FormattedItem?,
      delta: freezed == delta
          ? _value.delta
          : delta // ignore: cast_nullable_to_non_nullable
              as Delta?,
      response: freezed == response
          ? _value.response
          : response // ignore: cast_nullable_to_non_nullable
              as Response?,
    ) as $Val);
  }

  /// Create a copy of EventHandlerResult
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $FormattedItemCopyWith<$Res>? get item {
    if (_value.item == null) {
      return null;
    }

    return $FormattedItemCopyWith<$Res>(_value.item!, (value) {
      return _then(_value.copyWith(item: value) as $Val);
    });
  }

  /// Create a copy of EventHandlerResult
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $DeltaCopyWith<$Res>? get delta {
    if (_value.delta == null) {
      return null;
    }

    return $DeltaCopyWith<$Res>(_value.delta!, (value) {
      return _then(_value.copyWith(delta: value) as $Val);
    });
  }

  /// Create a copy of EventHandlerResult
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ResponseCopyWith<$Res>? get response {
    if (_value.response == null) {
      return null;
    }

    return $ResponseCopyWith<$Res>(_value.response!, (value) {
      return _then(_value.copyWith(response: value) as $Val);
    });
  }
}

/// @nodoc
abstract class _$$EventHandlerResultImplCopyWith<$Res>
    implements $EventHandlerResultCopyWith<$Res> {
  factory _$$EventHandlerResultImplCopyWith(_$EventHandlerResultImpl value,
          $Res Function(_$EventHandlerResultImpl) then) =
      __$$EventHandlerResultImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) FormattedItem? item,
      @JsonKey(includeIfNull: false) Delta? delta,
      @JsonKey(includeIfNull: false) Response? response});

  @override
  $FormattedItemCopyWith<$Res>? get item;
  @override
  $DeltaCopyWith<$Res>? get delta;
  @override
  $ResponseCopyWith<$Res>? get response;
}

/// @nodoc
class __$$EventHandlerResultImplCopyWithImpl<$Res>
    extends _$EventHandlerResultCopyWithImpl<$Res, _$EventHandlerResultImpl>
    implements _$$EventHandlerResultImplCopyWith<$Res> {
  __$$EventHandlerResultImplCopyWithImpl(_$EventHandlerResultImpl _value,
      $Res Function(_$EventHandlerResultImpl) _then)
      : super(_value, _then);

  /// Create a copy of EventHandlerResult
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? item = freezed,
    Object? delta = freezed,
    Object? response = freezed,
  }) {
    return _then(_$EventHandlerResultImpl(
      item: freezed == item
          ? _value.item
          : item // ignore: cast_nullable_to_non_nullable
              as FormattedItem?,
      delta: freezed == delta
          ? _value.delta
          : delta // ignore: cast_nullable_to_non_nullable
              as Delta?,
      response: freezed == response
          ? _value.response
          : response // ignore: cast_nullable_to_non_nullable
              as Response?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$EventHandlerResultImpl extends _EventHandlerResult {
  const _$EventHandlerResultImpl(
      {@JsonKey(includeIfNull: false) this.item,
      @JsonKey(includeIfNull: false) this.delta,
      @JsonKey(includeIfNull: false) this.response})
      : super._();

  factory _$EventHandlerResultImpl.fromJson(Map<String, dynamic> json) =>
      _$$EventHandlerResultImplFromJson(json);

  /// A formatted item.
  @override
  @JsonKey(includeIfNull: false)
  final FormattedItem? item;

  /// Delta object.
  @override
  @JsonKey(includeIfNull: false)
  final Delta? delta;

  /// The response resource.
  @override
  @JsonKey(includeIfNull: false)
  final Response? response;

  @override
  String toString() {
    return 'EventHandlerResult(item: $item, delta: $delta, response: $response)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$EventHandlerResultImpl &&
            (identical(other.item, item) || other.item == item) &&
            (identical(other.delta, delta) || other.delta == delta) &&
            (identical(other.response, response) ||
                other.response == response));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, item, delta, response);

  /// Create a copy of EventHandlerResult
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$EventHandlerResultImplCopyWith<_$EventHandlerResultImpl> get copyWith =>
      __$$EventHandlerResultImplCopyWithImpl<_$EventHandlerResultImpl>(
          this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$EventHandlerResultImplToJson(
      this,
    );
  }
}

abstract class _EventHandlerResult extends EventHandlerResult {
  const factory _EventHandlerResult(
          {@JsonKey(includeIfNull: false) final FormattedItem? item,
          @JsonKey(includeIfNull: false) final Delta? delta,
          @JsonKey(includeIfNull: false) final Response? response}) =
      _$EventHandlerResultImpl;
  const _EventHandlerResult._() : super._();

  factory _EventHandlerResult.fromJson(Map<String, dynamic> json) =
      _$EventHandlerResultImpl.fromJson;

  /// A formatted item.
  @override
  @JsonKey(includeIfNull: false)
  FormattedItem? get item;

  /// Delta object.
  @override
  @JsonKey(includeIfNull: false)
  Delta? get delta;

  /// The response resource.
  @override
  @JsonKey(includeIfNull: false)
  Response? get response;

  /// Create a copy of EventHandlerResult
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$EventHandlerResultImplCopyWith<_$EventHandlerResultImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

TranscriptionError _$TranscriptionErrorFromJson(Map<String, dynamic> json) {
  return _TranscriptionError.fromJson(json);
}

/// @nodoc
mixin _$TranscriptionError {
  /// The type of the error.
  @JsonKey(includeIfNull: false)
  String? get type => throw _privateConstructorUsedError;

  /// Error code, if any.
  @JsonKey(includeIfNull: false)
  String? get code => throw _privateConstructorUsedError;

  /// A human-readable error message.
  @JsonKey(includeIfNull: false)
  String? get message => throw _privateConstructorUsedError;

  /// Parameter related to the error, if any.
  @JsonKey(includeIfNull: false)
  String? get param => throw _privateConstructorUsedError;

  /// Serializes this TranscriptionError to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of TranscriptionError
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $TranscriptionErrorCopyWith<TranscriptionError> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $TranscriptionErrorCopyWith<$Res> {
  factory $TranscriptionErrorCopyWith(
          TranscriptionError value, $Res Function(TranscriptionError) then) =
      _$TranscriptionErrorCopyWithImpl<$Res, TranscriptionError>;
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) String? type,
      @JsonKey(includeIfNull: false) String? code,
      @JsonKey(includeIfNull: false) String? message,
      @JsonKey(includeIfNull: false) String? param});
}

/// @nodoc
class _$TranscriptionErrorCopyWithImpl<$Res, $Val extends TranscriptionError>
    implements $TranscriptionErrorCopyWith<$Res> {
  _$TranscriptionErrorCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of TranscriptionError
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = freezed,
    Object? code = freezed,
    Object? message = freezed,
    Object? param = freezed,
  }) {
    return _then(_value.copyWith(
      type: freezed == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as String?,
      code: freezed == code
          ? _value.code
          : code // ignore: cast_nullable_to_non_nullable
              as String?,
      message: freezed == message
          ? _value.message
          : message // ignore: cast_nullable_to_non_nullable
              as String?,
      param: freezed == param
          ? _value.param
          : param // ignore: cast_nullable_to_non_nullable
              as String?,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$TranscriptionErrorImplCopyWith<$Res>
    implements $TranscriptionErrorCopyWith<$Res> {
  factory _$$TranscriptionErrorImplCopyWith(_$TranscriptionErrorImpl value,
          $Res Function(_$TranscriptionErrorImpl) then) =
      __$$TranscriptionErrorImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) String? type,
      @JsonKey(includeIfNull: false) String? code,
      @JsonKey(includeIfNull: false) String? message,
      @JsonKey(includeIfNull: false) String? param});
}

/// @nodoc
class __$$TranscriptionErrorImplCopyWithImpl<$Res>
    extends _$TranscriptionErrorCopyWithImpl<$Res, _$TranscriptionErrorImpl>
    implements _$$TranscriptionErrorImplCopyWith<$Res> {
  __$$TranscriptionErrorImplCopyWithImpl(_$TranscriptionErrorImpl _value,
      $Res Function(_$TranscriptionErrorImpl) _then)
      : super(_value, _then);

  /// Create a copy of TranscriptionError
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = freezed,
    Object? code = freezed,
    Object? message = freezed,
    Object? param = freezed,
  }) {
    return _then(_$TranscriptionErrorImpl(
      type: freezed == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as String?,
      code: freezed == code
          ? _value.code
          : code // ignore: cast_nullable_to_non_nullable
              as String?,
      message: freezed == message
          ? _value.message
          : message // ignore: cast_nullable_to_non_nullable
              as String?,
      param: freezed == param
          ? _value.param
          : param // ignore: cast_nullable_to_non_nullable
              as String?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$TranscriptionErrorImpl extends _TranscriptionError {
  const _$TranscriptionErrorImpl(
      {@JsonKey(includeIfNull: false) this.type,
      @JsonKey(includeIfNull: false) this.code,
      @JsonKey(includeIfNull: false) this.message,
      @JsonKey(includeIfNull: false) this.param})
      : super._();

  factory _$TranscriptionErrorImpl.fromJson(Map<String, dynamic> json) =>
      _$$TranscriptionErrorImplFromJson(json);

  /// The type of the error.
  @override
  @JsonKey(includeIfNull: false)
  final String? type;

  /// Error code, if any.
  @override
  @JsonKey(includeIfNull: false)
  final String? code;

  /// A human-readable error message.
  @override
  @JsonKey(includeIfNull: false)
  final String? message;

  /// Parameter related to the error, if any.
  @override
  @JsonKey(includeIfNull: false)
  final String? param;

  @override
  String toString() {
    return 'TranscriptionError(type: $type, code: $code, message: $message, param: $param)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$TranscriptionErrorImpl &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.code, code) || other.code == code) &&
            (identical(other.message, message) || other.message == message) &&
            (identical(other.param, param) || other.param == param));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, type, code, message, param);

  /// Create a copy of TranscriptionError
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$TranscriptionErrorImplCopyWith<_$TranscriptionErrorImpl> get copyWith =>
      __$$TranscriptionErrorImplCopyWithImpl<_$TranscriptionErrorImpl>(
          this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$TranscriptionErrorImplToJson(
      this,
    );
  }
}

abstract class _TranscriptionError extends TranscriptionError {
  const factory _TranscriptionError(
          {@JsonKey(includeIfNull: false) final String? type,
          @JsonKey(includeIfNull: false) final String? code,
          @JsonKey(includeIfNull: false) final String? message,
          @JsonKey(includeIfNull: false) final String? param}) =
      _$TranscriptionErrorImpl;
  const _TranscriptionError._() : super._();

  factory _TranscriptionError.fromJson(Map<String, dynamic> json) =
      _$TranscriptionErrorImpl.fromJson;

  /// The type of the error.
  @override
  @JsonKey(includeIfNull: false)
  String? get type;

  /// Error code, if any.
  @override
  @JsonKey(includeIfNull: false)
  String? get code;

  /// A human-readable error message.
  @override
  @JsonKey(includeIfNull: false)
  String? get message;

  /// Parameter related to the error, if any.
  @override
  @JsonKey(includeIfNull: false)
  String? get param;

  /// Create a copy of TranscriptionError
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$TranscriptionErrorImplCopyWith<_$TranscriptionErrorImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

APIError _$APIErrorFromJson(Map<String, dynamic> json) {
  return _APIError.fromJson(json);
}

/// @nodoc
mixin _$APIError {
  /// The type of error (e.g., "invalid_request_error", "server_error").
  @JsonKey(includeIfNull: false)
  String? get type => throw _privateConstructorUsedError;

  /// Error code, if any.
  @JsonKey(includeIfNull: false)
  String? get code => throw _privateConstructorUsedError;

  /// A human-readable error message.
  @JsonKey(includeIfNull: false)
  String? get message => throw _privateConstructorUsedError;

  /// Parameter related to the error, if any.
  @JsonKey(includeIfNull: false)
  String? get param => throw _privateConstructorUsedError;

  /// The event_id of the client event that caused the error, if applicable.
  @JsonKey(name: 'event_id', includeIfNull: false)
  String? get eventId => throw _privateConstructorUsedError;

  /// Serializes this APIError to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of APIError
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $APIErrorCopyWith<APIError> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $APIErrorCopyWith<$Res> {
  factory $APIErrorCopyWith(APIError value, $Res Function(APIError) then) =
      _$APIErrorCopyWithImpl<$Res, APIError>;
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) String? type,
      @JsonKey(includeIfNull: false) String? code,
      @JsonKey(includeIfNull: false) String? message,
      @JsonKey(includeIfNull: false) String? param,
      @JsonKey(name: 'event_id', includeIfNull: false) String? eventId});
}

/// @nodoc
class _$APIErrorCopyWithImpl<$Res, $Val extends APIError>
    implements $APIErrorCopyWith<$Res> {
  _$APIErrorCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of APIError
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = freezed,
    Object? code = freezed,
    Object? message = freezed,
    Object? param = freezed,
    Object? eventId = freezed,
  }) {
    return _then(_value.copyWith(
      type: freezed == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as String?,
      code: freezed == code
          ? _value.code
          : code // ignore: cast_nullable_to_non_nullable
              as String?,
      message: freezed == message
          ? _value.message
          : message // ignore: cast_nullable_to_non_nullable
              as String?,
      param: freezed == param
          ? _value.param
          : param // ignore: cast_nullable_to_non_nullable
              as String?,
      eventId: freezed == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String?,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$APIErrorImplCopyWith<$Res>
    implements $APIErrorCopyWith<$Res> {
  factory _$$APIErrorImplCopyWith(
          _$APIErrorImpl value, $Res Function(_$APIErrorImpl) then) =
      __$$APIErrorImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(includeIfNull: false) String? type,
      @JsonKey(includeIfNull: false) String? code,
      @JsonKey(includeIfNull: false) String? message,
      @JsonKey(includeIfNull: false) String? param,
      @JsonKey(name: 'event_id', includeIfNull: false) String? eventId});
}

/// @nodoc
class __$$APIErrorImplCopyWithImpl<$Res>
    extends _$APIErrorCopyWithImpl<$Res, _$APIErrorImpl>
    implements _$$APIErrorImplCopyWith<$Res> {
  __$$APIErrorImplCopyWithImpl(
      _$APIErrorImpl _value, $Res Function(_$APIErrorImpl) _then)
      : super(_value, _then);

  /// Create a copy of APIError
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = freezed,
    Object? code = freezed,
    Object? message = freezed,
    Object? param = freezed,
    Object? eventId = freezed,
  }) {
    return _then(_$APIErrorImpl(
      type: freezed == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as String?,
      code: freezed == code
          ? _value.code
          : code // ignore: cast_nullable_to_non_nullable
              as String?,
      message: freezed == message
          ? _value.message
          : message // ignore: cast_nullable_to_non_nullable
              as String?,
      param: freezed == param
          ? _value.param
          : param // ignore: cast_nullable_to_non_nullable
              as String?,
      eventId: freezed == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$APIErrorImpl extends _APIError {
  const _$APIErrorImpl(
      {@JsonKey(includeIfNull: false) this.type,
      @JsonKey(includeIfNull: false) this.code,
      @JsonKey(includeIfNull: false) this.message,
      @JsonKey(includeIfNull: false) this.param,
      @JsonKey(name: 'event_id', includeIfNull: false) this.eventId})
      : super._();

  factory _$APIErrorImpl.fromJson(Map<String, dynamic> json) =>
      _$$APIErrorImplFromJson(json);

  /// The type of error (e.g., "invalid_request_error", "server_error").
  @override
  @JsonKey(includeIfNull: false)
  final String? type;

  /// Error code, if any.
  @override
  @JsonKey(includeIfNull: false)
  final String? code;

  /// A human-readable error message.
  @override
  @JsonKey(includeIfNull: false)
  final String? message;

  /// Parameter related to the error, if any.
  @override
  @JsonKey(includeIfNull: false)
  final String? param;

  /// The event_id of the client event that caused the error, if applicable.
  @override
  @JsonKey(name: 'event_id', includeIfNull: false)
  final String? eventId;

  @override
  String toString() {
    return 'APIError(type: $type, code: $code, message: $message, param: $param, eventId: $eventId)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$APIErrorImpl &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.code, code) || other.code == code) &&
            (identical(other.message, message) || other.message == message) &&
            (identical(other.param, param) || other.param == param) &&
            (identical(other.eventId, eventId) || other.eventId == eventId));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, type, code, message, param, eventId);

  /// Create a copy of APIError
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$APIErrorImplCopyWith<_$APIErrorImpl> get copyWith =>
      __$$APIErrorImplCopyWithImpl<_$APIErrorImpl>(this, _$identity);

  @override
  Map<String, dynamic> toJson() {
    return _$$APIErrorImplToJson(
      this,
    );
  }
}

abstract class _APIError extends APIError {
  const factory _APIError(
      {@JsonKey(includeIfNull: false) final String? type,
      @JsonKey(includeIfNull: false) final String? code,
      @JsonKey(includeIfNull: false) final String? message,
      @JsonKey(includeIfNull: false) final String? param,
      @JsonKey(name: 'event_id', includeIfNull: false)
      final String? eventId}) = _$APIErrorImpl;
  const _APIError._() : super._();

  factory _APIError.fromJson(Map<String, dynamic> json) =
      _$APIErrorImpl.fromJson;

  /// The type of error (e.g., "invalid_request_error", "server_error").
  @override
  @JsonKey(includeIfNull: false)
  String? get type;

  /// Error code, if any.
  @override
  @JsonKey(includeIfNull: false)
  String? get code;

  /// A human-readable error message.
  @override
  @JsonKey(includeIfNull: false)
  String? get message;

  /// Parameter related to the error, if any.
  @override
  @JsonKey(includeIfNull: false)
  String? get param;

  /// The event_id of the client event that caused the error, if applicable.
  @override
  @JsonKey(name: 'event_id', includeIfNull: false)
  String? get eventId;

  /// Create a copy of APIError
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$APIErrorImplCopyWith<_$APIErrorImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

ContentPart _$ContentPartFromJson(Map<String, dynamic> json) {
  switch (json['type']) {
    case 'input_text':
      return ContentPartInputText.fromJson(json);
    case 'input_audio':
      return ContentPartInputAudio.fromJson(json);
    case 'text':
      return ContentPartText.fromJson(json);
    case 'audio':
      return ContentPartAudio.fromJson(json);

    default:
      throw CheckedFromJsonException(
          json, 'type', 'ContentPart', 'Invalid union type "${json['type']}"!');
  }
}

/// @nodoc
mixin _$ContentPart {
  /// The content type.
  ContentType get type => throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(ContentType type, String text) inputText,
    required TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)
        inputAudio,
    required TResult Function(ContentType type, String text) text,
    required TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)
        audio,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(ContentType type, String text)? inputText,
    TResult? Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        inputAudio,
    TResult? Function(ContentType type, String text)? text,
    TResult? Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        audio,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(ContentType type, String text)? inputText,
    TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        inputAudio,
    TResult Function(ContentType type, String text)? text,
    TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        audio,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ContentPartInputText value) inputText,
    required TResult Function(ContentPartInputAudio value) inputAudio,
    required TResult Function(ContentPartText value) text,
    required TResult Function(ContentPartAudio value) audio,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ContentPartInputText value)? inputText,
    TResult? Function(ContentPartInputAudio value)? inputAudio,
    TResult? Function(ContentPartText value)? text,
    TResult? Function(ContentPartAudio value)? audio,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ContentPartInputText value)? inputText,
    TResult Function(ContentPartInputAudio value)? inputAudio,
    TResult Function(ContentPartText value)? text,
    TResult Function(ContentPartAudio value)? audio,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;

  /// Serializes this ContentPart to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of ContentPart
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $ContentPartCopyWith<ContentPart> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $ContentPartCopyWith<$Res> {
  factory $ContentPartCopyWith(
          ContentPart value, $Res Function(ContentPart) then) =
      _$ContentPartCopyWithImpl<$Res, ContentPart>;
  @useResult
  $Res call({ContentType type});
}

/// @nodoc
class _$ContentPartCopyWithImpl<$Res, $Val extends ContentPart>
    implements $ContentPartCopyWith<$Res> {
  _$ContentPartCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of ContentPart
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
  }) {
    return _then(_value.copyWith(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ContentType,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$ContentPartInputTextImplCopyWith<$Res>
    implements $ContentPartCopyWith<$Res> {
  factory _$$ContentPartInputTextImplCopyWith(_$ContentPartInputTextImpl value,
          $Res Function(_$ContentPartInputTextImpl) then) =
      __$$ContentPartInputTextImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call({ContentType type, String text});
}

/// @nodoc
class __$$ContentPartInputTextImplCopyWithImpl<$Res>
    extends _$ContentPartCopyWithImpl<$Res, _$ContentPartInputTextImpl>
    implements _$$ContentPartInputTextImplCopyWith<$Res> {
  __$$ContentPartInputTextImplCopyWithImpl(_$ContentPartInputTextImpl _value,
      $Res Function(_$ContentPartInputTextImpl) _then)
      : super(_value, _then);

  /// Create a copy of ContentPart
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? text = null,
  }) {
    return _then(_$ContentPartInputTextImpl(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ContentType,
      text: null == text
          ? _value.text
          : text // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ContentPartInputTextImpl extends ContentPartInputText {
  const _$ContentPartInputTextImpl(
      {this.type = ContentType.inputText, required this.text})
      : super._();

  factory _$ContentPartInputTextImpl.fromJson(Map<String, dynamic> json) =>
      _$$ContentPartInputTextImplFromJson(json);

  /// The content type.
  @override
  @JsonKey()
  final ContentType type;

  /// The text content.
  @override
  final String text;

  @override
  String toString() {
    return 'ContentPart.inputText(type: $type, text: $text)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ContentPartInputTextImpl &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.text, text) || other.text == text));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, type, text);

  /// Create a copy of ContentPart
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ContentPartInputTextImplCopyWith<_$ContentPartInputTextImpl>
      get copyWith =>
          __$$ContentPartInputTextImplCopyWithImpl<_$ContentPartInputTextImpl>(
              this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(ContentType type, String text) inputText,
    required TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)
        inputAudio,
    required TResult Function(ContentType type, String text) text,
    required TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)
        audio,
  }) {
    return inputText(type, this.text);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(ContentType type, String text)? inputText,
    TResult? Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        inputAudio,
    TResult? Function(ContentType type, String text)? text,
    TResult? Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        audio,
  }) {
    return inputText?.call(type, this.text);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(ContentType type, String text)? inputText,
    TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        inputAudio,
    TResult Function(ContentType type, String text)? text,
    TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        audio,
    required TResult orElse(),
  }) {
    if (inputText != null) {
      return inputText(type, this.text);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ContentPartInputText value) inputText,
    required TResult Function(ContentPartInputAudio value) inputAudio,
    required TResult Function(ContentPartText value) text,
    required TResult Function(ContentPartAudio value) audio,
  }) {
    return inputText(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ContentPartInputText value)? inputText,
    TResult? Function(ContentPartInputAudio value)? inputAudio,
    TResult? Function(ContentPartText value)? text,
    TResult? Function(ContentPartAudio value)? audio,
  }) {
    return inputText?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ContentPartInputText value)? inputText,
    TResult Function(ContentPartInputAudio value)? inputAudio,
    TResult Function(ContentPartText value)? text,
    TResult Function(ContentPartAudio value)? audio,
    required TResult orElse(),
  }) {
    if (inputText != null) {
      return inputText(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$ContentPartInputTextImplToJson(
      this,
    );
  }
}

abstract class ContentPartInputText extends ContentPart {
  const factory ContentPartInputText(
      {final ContentType type,
      required final String text}) = _$ContentPartInputTextImpl;
  const ContentPartInputText._() : super._();

  factory ContentPartInputText.fromJson(Map<String, dynamic> json) =
      _$ContentPartInputTextImpl.fromJson;

  /// The content type.
  @override
  ContentType get type;

  /// The text content.
  String get text;

  /// Create a copy of ContentPart
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ContentPartInputTextImplCopyWith<_$ContentPartInputTextImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$ContentPartInputAudioImplCopyWith<$Res>
    implements $ContentPartCopyWith<$Res> {
  factory _$$ContentPartInputAudioImplCopyWith(
          _$ContentPartInputAudioImpl value,
          $Res Function(_$ContentPartInputAudioImpl) then) =
      __$$ContentPartInputAudioImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {ContentType type,
      @JsonKey(includeIfNull: false) String? audio,
      @JsonKey(includeIfNull: false) String? transcript});
}

/// @nodoc
class __$$ContentPartInputAudioImplCopyWithImpl<$Res>
    extends _$ContentPartCopyWithImpl<$Res, _$ContentPartInputAudioImpl>
    implements _$$ContentPartInputAudioImplCopyWith<$Res> {
  __$$ContentPartInputAudioImplCopyWithImpl(_$ContentPartInputAudioImpl _value,
      $Res Function(_$ContentPartInputAudioImpl) _then)
      : super(_value, _then);

  /// Create a copy of ContentPart
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? audio = freezed,
    Object? transcript = freezed,
  }) {
    return _then(_$ContentPartInputAudioImpl(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ContentType,
      audio: freezed == audio
          ? _value.audio
          : audio // ignore: cast_nullable_to_non_nullable
              as String?,
      transcript: freezed == transcript
          ? _value.transcript
          : transcript // ignore: cast_nullable_to_non_nullable
              as String?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ContentPartInputAudioImpl extends ContentPartInputAudio {
  const _$ContentPartInputAudioImpl(
      {this.type = ContentType.inputAudio,
      @JsonKey(includeIfNull: false) this.audio,
      @JsonKey(includeIfNull: false) this.transcript})
      : super._();

  factory _$ContentPartInputAudioImpl.fromJson(Map<String, dynamic> json) =>
      _$$ContentPartInputAudioImplFromJson(json);

  /// The content type.
  @override
  @JsonKey()
  final ContentType type;

  /// Base64-encoded audio bytes.
  @override
  @JsonKey(includeIfNull: false)
  final String? audio;

  /// The transcript of the audio.
  @override
  @JsonKey(includeIfNull: false)
  final String? transcript;

  @override
  String toString() {
    return 'ContentPart.inputAudio(type: $type, audio: $audio, transcript: $transcript)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ContentPartInputAudioImpl &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.audio, audio) || other.audio == audio) &&
            (identical(other.transcript, transcript) ||
                other.transcript == transcript));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, type, audio, transcript);

  /// Create a copy of ContentPart
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ContentPartInputAudioImplCopyWith<_$ContentPartInputAudioImpl>
      get copyWith => __$$ContentPartInputAudioImplCopyWithImpl<
          _$ContentPartInputAudioImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(ContentType type, String text) inputText,
    required TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)
        inputAudio,
    required TResult Function(ContentType type, String text) text,
    required TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)
        audio,
  }) {
    return inputAudio(type, this.audio, transcript);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(ContentType type, String text)? inputText,
    TResult? Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        inputAudio,
    TResult? Function(ContentType type, String text)? text,
    TResult? Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        audio,
  }) {
    return inputAudio?.call(type, this.audio, transcript);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(ContentType type, String text)? inputText,
    TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        inputAudio,
    TResult Function(ContentType type, String text)? text,
    TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        audio,
    required TResult orElse(),
  }) {
    if (inputAudio != null) {
      return inputAudio(type, this.audio, transcript);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ContentPartInputText value) inputText,
    required TResult Function(ContentPartInputAudio value) inputAudio,
    required TResult Function(ContentPartText value) text,
    required TResult Function(ContentPartAudio value) audio,
  }) {
    return inputAudio(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ContentPartInputText value)? inputText,
    TResult? Function(ContentPartInputAudio value)? inputAudio,
    TResult? Function(ContentPartText value)? text,
    TResult? Function(ContentPartAudio value)? audio,
  }) {
    return inputAudio?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ContentPartInputText value)? inputText,
    TResult Function(ContentPartInputAudio value)? inputAudio,
    TResult Function(ContentPartText value)? text,
    TResult Function(ContentPartAudio value)? audio,
    required TResult orElse(),
  }) {
    if (inputAudio != null) {
      return inputAudio(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$ContentPartInputAudioImplToJson(
      this,
    );
  }
}

abstract class ContentPartInputAudio extends ContentPart {
  const factory ContentPartInputAudio(
          {final ContentType type,
          @JsonKey(includeIfNull: false) final String? audio,
          @JsonKey(includeIfNull: false) final String? transcript}) =
      _$ContentPartInputAudioImpl;
  const ContentPartInputAudio._() : super._();

  factory ContentPartInputAudio.fromJson(Map<String, dynamic> json) =
      _$ContentPartInputAudioImpl.fromJson;

  /// The content type.
  @override
  ContentType get type;

  /// Base64-encoded audio bytes.
  @JsonKey(includeIfNull: false)
  String? get audio;

  /// The transcript of the audio.
  @JsonKey(includeIfNull: false)
  String? get transcript;

  /// Create a copy of ContentPart
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ContentPartInputAudioImplCopyWith<_$ContentPartInputAudioImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$ContentPartTextImplCopyWith<$Res>
    implements $ContentPartCopyWith<$Res> {
  factory _$$ContentPartTextImplCopyWith(_$ContentPartTextImpl value,
          $Res Function(_$ContentPartTextImpl) then) =
      __$$ContentPartTextImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call({ContentType type, String text});
}

/// @nodoc
class __$$ContentPartTextImplCopyWithImpl<$Res>
    extends _$ContentPartCopyWithImpl<$Res, _$ContentPartTextImpl>
    implements _$$ContentPartTextImplCopyWith<$Res> {
  __$$ContentPartTextImplCopyWithImpl(
      _$ContentPartTextImpl _value, $Res Function(_$ContentPartTextImpl) _then)
      : super(_value, _then);

  /// Create a copy of ContentPart
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? text = null,
  }) {
    return _then(_$ContentPartTextImpl(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ContentType,
      text: null == text
          ? _value.text
          : text // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ContentPartTextImpl extends ContentPartText {
  const _$ContentPartTextImpl(
      {this.type = ContentType.text, required this.text})
      : super._();

  factory _$ContentPartTextImpl.fromJson(Map<String, dynamic> json) =>
      _$$ContentPartTextImplFromJson(json);

  /// The content type.
  @override
  @JsonKey()
  final ContentType type;

  /// The text content.
  @override
  final String text;

  @override
  String toString() {
    return 'ContentPart.text(type: $type, text: $text)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ContentPartTextImpl &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.text, text) || other.text == text));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, type, text);

  /// Create a copy of ContentPart
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ContentPartTextImplCopyWith<_$ContentPartTextImpl> get copyWith =>
      __$$ContentPartTextImplCopyWithImpl<_$ContentPartTextImpl>(
          this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(ContentType type, String text) inputText,
    required TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)
        inputAudio,
    required TResult Function(ContentType type, String text) text,
    required TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)
        audio,
  }) {
    return text(type, this.text);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(ContentType type, String text)? inputText,
    TResult? Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        inputAudio,
    TResult? Function(ContentType type, String text)? text,
    TResult? Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        audio,
  }) {
    return text?.call(type, this.text);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(ContentType type, String text)? inputText,
    TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        inputAudio,
    TResult Function(ContentType type, String text)? text,
    TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        audio,
    required TResult orElse(),
  }) {
    if (text != null) {
      return text(type, this.text);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ContentPartInputText value) inputText,
    required TResult Function(ContentPartInputAudio value) inputAudio,
    required TResult Function(ContentPartText value) text,
    required TResult Function(ContentPartAudio value) audio,
  }) {
    return text(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ContentPartInputText value)? inputText,
    TResult? Function(ContentPartInputAudio value)? inputAudio,
    TResult? Function(ContentPartText value)? text,
    TResult? Function(ContentPartAudio value)? audio,
  }) {
    return text?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ContentPartInputText value)? inputText,
    TResult Function(ContentPartInputAudio value)? inputAudio,
    TResult Function(ContentPartText value)? text,
    TResult Function(ContentPartAudio value)? audio,
    required TResult orElse(),
  }) {
    if (text != null) {
      return text(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$ContentPartTextImplToJson(
      this,
    );
  }
}

abstract class ContentPartText extends ContentPart {
  const factory ContentPartText(
      {final ContentType type,
      required final String text}) = _$ContentPartTextImpl;
  const ContentPartText._() : super._();

  factory ContentPartText.fromJson(Map<String, dynamic> json) =
      _$ContentPartTextImpl.fromJson;

  /// The content type.
  @override
  ContentType get type;

  /// The text content.
  String get text;

  /// Create a copy of ContentPart
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ContentPartTextImplCopyWith<_$ContentPartTextImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$ContentPartAudioImplCopyWith<$Res>
    implements $ContentPartCopyWith<$Res> {
  factory _$$ContentPartAudioImplCopyWith(_$ContentPartAudioImpl value,
          $Res Function(_$ContentPartAudioImpl) then) =
      __$$ContentPartAudioImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {ContentType type,
      @JsonKey(includeIfNull: false) String? audio,
      @JsonKey(includeIfNull: false) String? transcript});
}

/// @nodoc
class __$$ContentPartAudioImplCopyWithImpl<$Res>
    extends _$ContentPartCopyWithImpl<$Res, _$ContentPartAudioImpl>
    implements _$$ContentPartAudioImplCopyWith<$Res> {
  __$$ContentPartAudioImplCopyWithImpl(_$ContentPartAudioImpl _value,
      $Res Function(_$ContentPartAudioImpl) _then)
      : super(_value, _then);

  /// Create a copy of ContentPart
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? audio = freezed,
    Object? transcript = freezed,
  }) {
    return _then(_$ContentPartAudioImpl(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ContentType,
      audio: freezed == audio
          ? _value.audio
          : audio // ignore: cast_nullable_to_non_nullable
              as String?,
      transcript: freezed == transcript
          ? _value.transcript
          : transcript // ignore: cast_nullable_to_non_nullable
              as String?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ContentPartAudioImpl extends ContentPartAudio {
  const _$ContentPartAudioImpl(
      {this.type = ContentType.audio,
      @JsonKey(includeIfNull: false) this.audio,
      @JsonKey(includeIfNull: false) this.transcript})
      : super._();

  factory _$ContentPartAudioImpl.fromJson(Map<String, dynamic> json) =>
      _$$ContentPartAudioImplFromJson(json);

  /// The content type.
  @override
  @JsonKey()
  final ContentType type;

  /// Base64-encoded audio bytes.
  @override
  @JsonKey(includeIfNull: false)
  final String? audio;

  /// The transcript of the audio.
  @override
  @JsonKey(includeIfNull: false)
  final String? transcript;

  @override
  String toString() {
    return 'ContentPart.audio(type: $type, audio: $audio, transcript: $transcript)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ContentPartAudioImpl &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.audio, audio) || other.audio == audio) &&
            (identical(other.transcript, transcript) ||
                other.transcript == transcript));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, type, audio, transcript);

  /// Create a copy of ContentPart
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ContentPartAudioImplCopyWith<_$ContentPartAudioImpl> get copyWith =>
      __$$ContentPartAudioImplCopyWithImpl<_$ContentPartAudioImpl>(
          this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(ContentType type, String text) inputText,
    required TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)
        inputAudio,
    required TResult Function(ContentType type, String text) text,
    required TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)
        audio,
  }) {
    return audio(type, this.audio, transcript);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(ContentType type, String text)? inputText,
    TResult? Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        inputAudio,
    TResult? Function(ContentType type, String text)? text,
    TResult? Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        audio,
  }) {
    return audio?.call(type, this.audio, transcript);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(ContentType type, String text)? inputText,
    TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        inputAudio,
    TResult Function(ContentType type, String text)? text,
    TResult Function(
            ContentType type,
            @JsonKey(includeIfNull: false) String? audio,
            @JsonKey(includeIfNull: false) String? transcript)?
        audio,
    required TResult orElse(),
  }) {
    if (audio != null) {
      return audio(type, this.audio, transcript);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ContentPartInputText value) inputText,
    required TResult Function(ContentPartInputAudio value) inputAudio,
    required TResult Function(ContentPartText value) text,
    required TResult Function(ContentPartAudio value) audio,
  }) {
    return audio(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ContentPartInputText value)? inputText,
    TResult? Function(ContentPartInputAudio value)? inputAudio,
    TResult? Function(ContentPartText value)? text,
    TResult? Function(ContentPartAudio value)? audio,
  }) {
    return audio?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ContentPartInputText value)? inputText,
    TResult Function(ContentPartInputAudio value)? inputAudio,
    TResult Function(ContentPartText value)? text,
    TResult Function(ContentPartAudio value)? audio,
    required TResult orElse(),
  }) {
    if (audio != null) {
      return audio(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$ContentPartAudioImplToJson(
      this,
    );
  }
}

abstract class ContentPartAudio extends ContentPart {
  const factory ContentPartAudio(
          {final ContentType type,
          @JsonKey(includeIfNull: false) final String? audio,
          @JsonKey(includeIfNull: false) final String? transcript}) =
      _$ContentPartAudioImpl;
  const ContentPartAudio._() : super._();

  factory ContentPartAudio.fromJson(Map<String, dynamic> json) =
      _$ContentPartAudioImpl.fromJson;

  /// The content type.
  @override
  ContentType get type;

  /// Base64-encoded audio bytes.
  @JsonKey(includeIfNull: false)
  String? get audio;

  /// The transcript of the audio.
  @JsonKey(includeIfNull: false)
  String? get transcript;

  /// Create a copy of ContentPart
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ContentPartAudioImplCopyWith<_$ContentPartAudioImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

Item _$ItemFromJson(Map<String, dynamic> json) {
  switch (json['type']) {
    case 'message':
      return ItemMessage.fromJson(json);
    case 'function_call':
      return ItemFunctionCall.fromJson(json);
    case 'function_call_output':
      return ItemFunctionCallOutput.fromJson(json);

    default:
      throw CheckedFromJsonException(
          json, 'type', 'Item', 'Invalid union type "${json['type']}"!');
  }
}

/// @nodoc
mixin _$Item {
  /// The unique ID of the item, this can be generated by the client to help manage server-side context,
  /// but is not required because the server will generate one if not provided.
  String get id => throw _privateConstructorUsedError;

  /// The object type, must be "realtime.item".
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  ObjectType? get object => throw _privateConstructorUsedError;

  /// The type of the item.
  ItemType get type => throw _privateConstructorUsedError;

  /// The status of the item. These have no effect on the conversation, but are accepted for consistency
  /// with the `conversation.item.created` event.
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  ItemStatus? get status => throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            ItemRole role,
            List<ContentPart> content)
        message,
    required TResult Function(
            String id,
            ObjectType object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String name,
            String arguments)
        functionCall,
    required TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String output)
        functionCallOutput,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            ItemRole role,
            List<ContentPart> content)?
        message,
    TResult? Function(
            String id,
            ObjectType object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String name,
            String arguments)?
        functionCall,
    TResult? Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String output)?
        functionCallOutput,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            ItemRole role,
            List<ContentPart> content)?
        message,
    TResult Function(
            String id,
            ObjectType object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String name,
            String arguments)?
        functionCall,
    TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String output)?
        functionCallOutput,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ItemMessage value) message,
    required TResult Function(ItemFunctionCall value) functionCall,
    required TResult Function(ItemFunctionCallOutput value) functionCallOutput,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ItemMessage value)? message,
    TResult? Function(ItemFunctionCall value)? functionCall,
    TResult? Function(ItemFunctionCallOutput value)? functionCallOutput,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ItemMessage value)? message,
    TResult Function(ItemFunctionCall value)? functionCall,
    TResult Function(ItemFunctionCallOutput value)? functionCallOutput,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;

  /// Serializes this Item to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of Item
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $ItemCopyWith<Item> get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $ItemCopyWith<$Res> {
  factory $ItemCopyWith(Item value, $Res Function(Item) then) =
      _$ItemCopyWithImpl<$Res, Item>;
  @useResult
  $Res call(
      {String id,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      ObjectType object,
      ItemType type,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      ItemStatus? status});
}

/// @nodoc
class _$ItemCopyWithImpl<$Res, $Val extends Item>
    implements $ItemCopyWith<$Res> {
  _$ItemCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of Item
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? id = null,
    Object? object = null,
    Object? type = null,
    Object? status = freezed,
  }) {
    return _then(_value.copyWith(
      id: null == id
          ? _value.id
          : id // ignore: cast_nullable_to_non_nullable
              as String,
      object: null == object
          ? _value.object!
          : object // ignore: cast_nullable_to_non_nullable
              as ObjectType,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ItemType,
      status: freezed == status
          ? _value.status
          : status // ignore: cast_nullable_to_non_nullable
              as ItemStatus?,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$ItemMessageImplCopyWith<$Res> implements $ItemCopyWith<$Res> {
  factory _$$ItemMessageImplCopyWith(
          _$ItemMessageImpl value, $Res Function(_$ItemMessageImpl) then) =
      __$$ItemMessageImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {String id,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      ObjectType? object,
      ItemType type,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      ItemStatus? status,
      ItemRole role,
      List<ContentPart> content});
}

/// @nodoc
class __$$ItemMessageImplCopyWithImpl<$Res>
    extends _$ItemCopyWithImpl<$Res, _$ItemMessageImpl>
    implements _$$ItemMessageImplCopyWith<$Res> {
  __$$ItemMessageImplCopyWithImpl(
      _$ItemMessageImpl _value, $Res Function(_$ItemMessageImpl) _then)
      : super(_value, _then);

  /// Create a copy of Item
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? id = null,
    Object? object = freezed,
    Object? type = null,
    Object? status = freezed,
    Object? role = null,
    Object? content = null,
  }) {
    return _then(_$ItemMessageImpl(
      id: null == id
          ? _value.id
          : id // ignore: cast_nullable_to_non_nullable
              as String,
      object: freezed == object
          ? _value.object
          : object // ignore: cast_nullable_to_non_nullable
              as ObjectType?,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ItemType,
      status: freezed == status
          ? _value.status
          : status // ignore: cast_nullable_to_non_nullable
              as ItemStatus?,
      role: null == role
          ? _value.role
          : role // ignore: cast_nullable_to_non_nullable
              as ItemRole,
      content: null == content
          ? _value._content
          : content // ignore: cast_nullable_to_non_nullable
              as List<ContentPart>,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ItemMessageImpl extends ItemMessage {
  const _$ItemMessageImpl(
      {required this.id,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.object,
      this.type = ItemType.message,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.status,
      required this.role,
      required final List<ContentPart> content})
      : _content = content,
        super._();

  factory _$ItemMessageImpl.fromJson(Map<String, dynamic> json) =>
      _$$ItemMessageImplFromJson(json);

  /// The unique ID of the item, this can be generated by the client to help manage server-side context,
  /// but is not required because the server will generate one if not provided.
  @override
  final String id;

  /// The object type, must be "realtime.item".
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final ObjectType? object;

  /// The type of the item.
  @override
  @JsonKey()
  final ItemType type;

  /// The status of the item. These have no effect on the conversation, but are accepted for consistency
  /// with the `conversation.item.created` event.
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final ItemStatus? status;

  /// The role of the message sender.
  @override
  final ItemRole role;

  /// The content of the message. Message items with a role of `system` support only `input_text` content,
  /// message items of role `user` support `input_text` and `input_audio` content, and message items of role
  /// `assistant` support `text` content.
  final List<ContentPart> _content;

  /// The content of the message. Message items with a role of `system` support only `input_text` content,
  /// message items of role `user` support `input_text` and `input_audio` content, and message items of role
  /// `assistant` support `text` content.
  @override
  List<ContentPart> get content {
    if (_content is EqualUnmodifiableListView) return _content;
    // ignore: implicit_dynamic_type
    return EqualUnmodifiableListView(_content);
  }

  @override
  String toString() {
    return 'Item.message(id: $id, object: $object, type: $type, status: $status, role: $role, content: $content)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ItemMessageImpl &&
            (identical(other.id, id) || other.id == id) &&
            (identical(other.object, object) || other.object == object) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.status, status) || other.status == status) &&
            (identical(other.role, role) || other.role == role) &&
            const DeepCollectionEquality().equals(other._content, _content));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, id, object, type, status, role,
      const DeepCollectionEquality().hash(_content));

  /// Create a copy of Item
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ItemMessageImplCopyWith<_$ItemMessageImpl> get copyWith =>
      __$$ItemMessageImplCopyWithImpl<_$ItemMessageImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            ItemRole role,
            List<ContentPart> content)
        message,
    required TResult Function(
            String id,
            ObjectType object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String name,
            String arguments)
        functionCall,
    required TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String output)
        functionCallOutput,
  }) {
    return message(id, object, type, status, role, content);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            ItemRole role,
            List<ContentPart> content)?
        message,
    TResult? Function(
            String id,
            ObjectType object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String name,
            String arguments)?
        functionCall,
    TResult? Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String output)?
        functionCallOutput,
  }) {
    return message?.call(id, object, type, status, role, content);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            ItemRole role,
            List<ContentPart> content)?
        message,
    TResult Function(
            String id,
            ObjectType object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String name,
            String arguments)?
        functionCall,
    TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String output)?
        functionCallOutput,
    required TResult orElse(),
  }) {
    if (message != null) {
      return message(id, object, type, status, role, content);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ItemMessage value) message,
    required TResult Function(ItemFunctionCall value) functionCall,
    required TResult Function(ItemFunctionCallOutput value) functionCallOutput,
  }) {
    return message(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ItemMessage value)? message,
    TResult? Function(ItemFunctionCall value)? functionCall,
    TResult? Function(ItemFunctionCallOutput value)? functionCallOutput,
  }) {
    return message?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ItemMessage value)? message,
    TResult Function(ItemFunctionCall value)? functionCall,
    TResult Function(ItemFunctionCallOutput value)? functionCallOutput,
    required TResult orElse(),
  }) {
    if (message != null) {
      return message(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$ItemMessageImplToJson(
      this,
    );
  }
}

abstract class ItemMessage extends Item {
  const factory ItemMessage(
      {required final String id,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      final ObjectType? object,
      final ItemType type,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      final ItemStatus? status,
      required final ItemRole role,
      required final List<ContentPart> content}) = _$ItemMessageImpl;
  const ItemMessage._() : super._();

  factory ItemMessage.fromJson(Map<String, dynamic> json) =
      _$ItemMessageImpl.fromJson;

  /// The unique ID of the item, this can be generated by the client to help manage server-side context,
  /// but is not required because the server will generate one if not provided.
  @override
  String get id;

  /// The object type, must be "realtime.item".
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  ObjectType? get object;

  /// The type of the item.
  @override
  ItemType get type;

  /// The status of the item. These have no effect on the conversation, but are accepted for consistency
  /// with the `conversation.item.created` event.
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  ItemStatus? get status;

  /// The role of the message sender.
  ItemRole get role;

  /// The content of the message. Message items with a role of `system` support only `input_text` content,
  /// message items of role `user` support `input_text` and `input_audio` content, and message items of role
  /// `assistant` support `text` content.
  List<ContentPart> get content;

  /// Create a copy of Item
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ItemMessageImplCopyWith<_$ItemMessageImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$ItemFunctionCallImplCopyWith<$Res>
    implements $ItemCopyWith<$Res> {
  factory _$$ItemFunctionCallImplCopyWith(_$ItemFunctionCallImpl value,
          $Res Function(_$ItemFunctionCallImpl) then) =
      __$$ItemFunctionCallImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {String id,
      ObjectType object,
      ItemType type,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      ItemStatus? status,
      @JsonKey(name: 'call_id') String callId,
      String name,
      String arguments});
}

/// @nodoc
class __$$ItemFunctionCallImplCopyWithImpl<$Res>
    extends _$ItemCopyWithImpl<$Res, _$ItemFunctionCallImpl>
    implements _$$ItemFunctionCallImplCopyWith<$Res> {
  __$$ItemFunctionCallImplCopyWithImpl(_$ItemFunctionCallImpl _value,
      $Res Function(_$ItemFunctionCallImpl) _then)
      : super(_value, _then);

  /// Create a copy of Item
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? id = null,
    Object? object = null,
    Object? type = null,
    Object? status = freezed,
    Object? callId = null,
    Object? name = null,
    Object? arguments = null,
  }) {
    return _then(_$ItemFunctionCallImpl(
      id: null == id
          ? _value.id
          : id // ignore: cast_nullable_to_non_nullable
              as String,
      object: null == object
          ? _value.object
          : object // ignore: cast_nullable_to_non_nullable
              as ObjectType,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ItemType,
      status: freezed == status
          ? _value.status
          : status // ignore: cast_nullable_to_non_nullable
              as ItemStatus?,
      callId: null == callId
          ? _value.callId
          : callId // ignore: cast_nullable_to_non_nullable
              as String,
      name: null == name
          ? _value.name
          : name // ignore: cast_nullable_to_non_nullable
              as String,
      arguments: null == arguments
          ? _value.arguments
          : arguments // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ItemFunctionCallImpl extends ItemFunctionCall {
  const _$ItemFunctionCallImpl(
      {required this.id,
      this.object = ObjectType.realtimeItem,
      this.type = ItemType.functionCall,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.status,
      @JsonKey(name: 'call_id') required this.callId,
      required this.name,
      required this.arguments})
      : super._();

  factory _$ItemFunctionCallImpl.fromJson(Map<String, dynamic> json) =>
      _$$ItemFunctionCallImplFromJson(json);

  /// The unique ID of the item, this can be generated by the client to help manage server-side context,
  /// but is not required because the server will generate one if not provided.
  @override
  final String id;

  /// The object type.
  @override
  @JsonKey()
  final ObjectType object;

  /// The type of the item.
  @override
  @JsonKey()
  final ItemType type;

  /// The status of the item. These have no effect on the conversation, but are accepted for consistency
  /// with the `conversation.item.created` event.
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final ItemStatus? status;

  /// The ID of the function call (for `function_call` and `function_call_output` items). If passed on a
  /// `function_call_output` item, the server will check that a `function_call` item with the same ID
  /// exists in the conversation history.
  @override
  @JsonKey(name: 'call_id')
  final String callId;

  /// The name of the function being called.
  @override
  final String name;

  /// The arguments of the function call.
  @override
  final String arguments;

  @override
  String toString() {
    return 'Item.functionCall(id: $id, object: $object, type: $type, status: $status, callId: $callId, name: $name, arguments: $arguments)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ItemFunctionCallImpl &&
            (identical(other.id, id) || other.id == id) &&
            (identical(other.object, object) || other.object == object) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.status, status) || other.status == status) &&
            (identical(other.callId, callId) || other.callId == callId) &&
            (identical(other.name, name) || other.name == name) &&
            (identical(other.arguments, arguments) ||
                other.arguments == arguments));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(
      runtimeType, id, object, type, status, callId, name, arguments);

  /// Create a copy of Item
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ItemFunctionCallImplCopyWith<_$ItemFunctionCallImpl> get copyWith =>
      __$$ItemFunctionCallImplCopyWithImpl<_$ItemFunctionCallImpl>(
          this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            ItemRole role,
            List<ContentPart> content)
        message,
    required TResult Function(
            String id,
            ObjectType object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String name,
            String arguments)
        functionCall,
    required TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String output)
        functionCallOutput,
  }) {
    return functionCall(id, object, type, status, callId, name, arguments);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            ItemRole role,
            List<ContentPart> content)?
        message,
    TResult? Function(
            String id,
            ObjectType object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String name,
            String arguments)?
        functionCall,
    TResult? Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String output)?
        functionCallOutput,
  }) {
    return functionCall?.call(
        id, object, type, status, callId, name, arguments);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            ItemRole role,
            List<ContentPart> content)?
        message,
    TResult Function(
            String id,
            ObjectType object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String name,
            String arguments)?
        functionCall,
    TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String output)?
        functionCallOutput,
    required TResult orElse(),
  }) {
    if (functionCall != null) {
      return functionCall(id, object, type, status, callId, name, arguments);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ItemMessage value) message,
    required TResult Function(ItemFunctionCall value) functionCall,
    required TResult Function(ItemFunctionCallOutput value) functionCallOutput,
  }) {
    return functionCall(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ItemMessage value)? message,
    TResult? Function(ItemFunctionCall value)? functionCall,
    TResult? Function(ItemFunctionCallOutput value)? functionCallOutput,
  }) {
    return functionCall?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ItemMessage value)? message,
    TResult Function(ItemFunctionCall value)? functionCall,
    TResult Function(ItemFunctionCallOutput value)? functionCallOutput,
    required TResult orElse(),
  }) {
    if (functionCall != null) {
      return functionCall(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$ItemFunctionCallImplToJson(
      this,
    );
  }
}

abstract class ItemFunctionCall extends Item {
  const factory ItemFunctionCall(
      {required final String id,
      final ObjectType object,
      final ItemType type,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      final ItemStatus? status,
      @JsonKey(name: 'call_id') required final String callId,
      required final String name,
      required final String arguments}) = _$ItemFunctionCallImpl;
  const ItemFunctionCall._() : super._();

  factory ItemFunctionCall.fromJson(Map<String, dynamic> json) =
      _$ItemFunctionCallImpl.fromJson;

  /// The unique ID of the item, this can be generated by the client to help manage server-side context,
  /// but is not required because the server will generate one if not provided.
  @override
  String get id;

  /// The object type.
  @override
  ObjectType get object;

  /// The type of the item.
  @override
  ItemType get type;

  /// The status of the item. These have no effect on the conversation, but are accepted for consistency
  /// with the `conversation.item.created` event.
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  ItemStatus? get status;

  /// The ID of the function call (for `function_call` and `function_call_output` items). If passed on a
  /// `function_call_output` item, the server will check that a `function_call` item with the same ID
  /// exists in the conversation history.
  @JsonKey(name: 'call_id')
  String get callId;

  /// The name of the function being called.
  String get name;

  /// The arguments of the function call.
  String get arguments;

  /// Create a copy of Item
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ItemFunctionCallImplCopyWith<_$ItemFunctionCallImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$ItemFunctionCallOutputImplCopyWith<$Res>
    implements $ItemCopyWith<$Res> {
  factory _$$ItemFunctionCallOutputImplCopyWith(
          _$ItemFunctionCallOutputImpl value,
          $Res Function(_$ItemFunctionCallOutputImpl) then) =
      __$$ItemFunctionCallOutputImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {String id,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      ObjectType? object,
      ItemType type,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      ItemStatus? status,
      @JsonKey(name: 'call_id') String callId,
      String output});
}

/// @nodoc
class __$$ItemFunctionCallOutputImplCopyWithImpl<$Res>
    extends _$ItemCopyWithImpl<$Res, _$ItemFunctionCallOutputImpl>
    implements _$$ItemFunctionCallOutputImplCopyWith<$Res> {
  __$$ItemFunctionCallOutputImplCopyWithImpl(
      _$ItemFunctionCallOutputImpl _value,
      $Res Function(_$ItemFunctionCallOutputImpl) _then)
      : super(_value, _then);

  /// Create a copy of Item
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? id = null,
    Object? object = freezed,
    Object? type = null,
    Object? status = freezed,
    Object? callId = null,
    Object? output = null,
  }) {
    return _then(_$ItemFunctionCallOutputImpl(
      id: null == id
          ? _value.id
          : id // ignore: cast_nullable_to_non_nullable
              as String,
      object: freezed == object
          ? _value.object
          : object // ignore: cast_nullable_to_non_nullable
              as ObjectType?,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ItemType,
      status: freezed == status
          ? _value.status
          : status // ignore: cast_nullable_to_non_nullable
              as ItemStatus?,
      callId: null == callId
          ? _value.callId
          : callId // ignore: cast_nullable_to_non_nullable
              as String,
      output: null == output
          ? _value.output
          : output // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ItemFunctionCallOutputImpl extends ItemFunctionCallOutput {
  const _$ItemFunctionCallOutputImpl(
      {required this.id,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.object,
      this.type = ItemType.functionCallOutput,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.status,
      @JsonKey(name: 'call_id') required this.callId,
      required this.output})
      : super._();

  factory _$ItemFunctionCallOutputImpl.fromJson(Map<String, dynamic> json) =>
      _$$ItemFunctionCallOutputImplFromJson(json);

  /// The unique ID of the item, this can be generated by the client to help manage server-side context,
  /// but is not required because the server will generate one if not provided.
  @override
  final String id;

  /// The object type. Always "realtime.item".
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final ObjectType? object;

  /// The type of the item.
  @override
  @JsonKey()
  final ItemType type;

  /// The status of the item. These have no effect on the conversation, but are accepted for consistency
  /// with the `conversation.item.created` event.
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final ItemStatus? status;

  /// The ID of the function call.
  @override
  @JsonKey(name: 'call_id')
  final String callId;

  /// The output of the function call.
  @override
  final String output;

  @override
  String toString() {
    return 'Item.functionCallOutput(id: $id, object: $object, type: $type, status: $status, callId: $callId, output: $output)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ItemFunctionCallOutputImpl &&
            (identical(other.id, id) || other.id == id) &&
            (identical(other.object, object) || other.object == object) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.status, status) || other.status == status) &&
            (identical(other.callId, callId) || other.callId == callId) &&
            (identical(other.output, output) || other.output == output));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, id, object, type, status, callId, output);

  /// Create a copy of Item
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ItemFunctionCallOutputImplCopyWith<_$ItemFunctionCallOutputImpl>
      get copyWith => __$$ItemFunctionCallOutputImplCopyWithImpl<
          _$ItemFunctionCallOutputImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            ItemRole role,
            List<ContentPart> content)
        message,
    required TResult Function(
            String id,
            ObjectType object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String name,
            String arguments)
        functionCall,
    required TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String output)
        functionCallOutput,
  }) {
    return functionCallOutput(id, object, type, status, callId, output);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            ItemRole role,
            List<ContentPart> content)?
        message,
    TResult? Function(
            String id,
            ObjectType object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String name,
            String arguments)?
        functionCall,
    TResult? Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String output)?
        functionCallOutput,
  }) {
    return functionCallOutput?.call(id, object, type, status, callId, output);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            ItemRole role,
            List<ContentPart> content)?
        message,
    TResult Function(
            String id,
            ObjectType object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String name,
            String arguments)?
        functionCall,
    TResult Function(
            String id,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ObjectType? object,
            ItemType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ItemStatus? status,
            @JsonKey(name: 'call_id') String callId,
            String output)?
        functionCallOutput,
    required TResult orElse(),
  }) {
    if (functionCallOutput != null) {
      return functionCallOutput(id, object, type, status, callId, output);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ItemMessage value) message,
    required TResult Function(ItemFunctionCall value) functionCall,
    required TResult Function(ItemFunctionCallOutput value) functionCallOutput,
  }) {
    return functionCallOutput(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ItemMessage value)? message,
    TResult? Function(ItemFunctionCall value)? functionCall,
    TResult? Function(ItemFunctionCallOutput value)? functionCallOutput,
  }) {
    return functionCallOutput?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ItemMessage value)? message,
    TResult Function(ItemFunctionCall value)? functionCall,
    TResult Function(ItemFunctionCallOutput value)? functionCallOutput,
    required TResult orElse(),
  }) {
    if (functionCallOutput != null) {
      return functionCallOutput(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$ItemFunctionCallOutputImplToJson(
      this,
    );
  }
}

abstract class ItemFunctionCallOutput extends Item {
  const factory ItemFunctionCallOutput(
      {required final String id,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      final ObjectType? object,
      final ItemType type,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      final ItemStatus? status,
      @JsonKey(name: 'call_id') required final String callId,
      required final String output}) = _$ItemFunctionCallOutputImpl;
  const ItemFunctionCallOutput._() : super._();

  factory ItemFunctionCallOutput.fromJson(Map<String, dynamic> json) =
      _$ItemFunctionCallOutputImpl.fromJson;

  /// The unique ID of the item, this can be generated by the client to help manage server-side context,
  /// but is not required because the server will generate one if not provided.
  @override
  String get id;

  /// The object type. Always "realtime.item".
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  ObjectType? get object;

  /// The type of the item.
  @override
  ItemType get type;

  /// The status of the item. These have no effect on the conversation, but are accepted for consistency
  /// with the `conversation.item.created` event.
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  ItemStatus? get status;

  /// The ID of the function call.
  @JsonKey(name: 'call_id')
  String get callId;

  /// The output of the function call.
  String get output;

  /// Create a copy of Item
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ItemFunctionCallOutputImplCopyWith<_$ItemFunctionCallOutputImpl>
      get copyWith => throw _privateConstructorUsedError;
}

ResponseStatusDetails _$ResponseStatusDetailsFromJson(
    Map<String, dynamic> json) {
  switch (json['type']) {
    case 'cancelled':
      return ResponseStatusDetailsCancelled.fromJson(json);
    case 'incomplete':
      return ResponseStatusDetailsIncomplete.fromJson(json);
    case 'failed':
      return ResponseStatusDetailsFailed.fromJson(json);

    default:
      throw CheckedFromJsonException(json, 'type', 'ResponseStatusDetails',
          'Invalid union type "${json['type']}"!');
  }
}

/// @nodoc
mixin _$ResponseStatusDetails {
  /// The type of error that caused the response to fail.
  ResponseStatusType get type => throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)
        cancelled,
    required TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)
        incomplete,
    required TResult Function(ResponseStatusType type,
            @JsonKey(includeIfNull: false) APIError? error)
        failed,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        cancelled,
    TResult? Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        incomplete,
    TResult? Function(ResponseStatusType type,
            @JsonKey(includeIfNull: false) APIError? error)?
        failed,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        cancelled,
    TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        incomplete,
    TResult Function(ResponseStatusType type,
            @JsonKey(includeIfNull: false) APIError? error)?
        failed,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ResponseStatusDetailsCancelled value) cancelled,
    required TResult Function(ResponseStatusDetailsIncomplete value) incomplete,
    required TResult Function(ResponseStatusDetailsFailed value) failed,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ResponseStatusDetailsCancelled value)? cancelled,
    TResult? Function(ResponseStatusDetailsIncomplete value)? incomplete,
    TResult? Function(ResponseStatusDetailsFailed value)? failed,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ResponseStatusDetailsCancelled value)? cancelled,
    TResult Function(ResponseStatusDetailsIncomplete value)? incomplete,
    TResult Function(ResponseStatusDetailsFailed value)? failed,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;

  /// Serializes this ResponseStatusDetails to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of ResponseStatusDetails
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $ResponseStatusDetailsCopyWith<ResponseStatusDetails> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $ResponseStatusDetailsCopyWith<$Res> {
  factory $ResponseStatusDetailsCopyWith(ResponseStatusDetails value,
          $Res Function(ResponseStatusDetails) then) =
      _$ResponseStatusDetailsCopyWithImpl<$Res, ResponseStatusDetails>;
  @useResult
  $Res call({ResponseStatusType type});
}

/// @nodoc
class _$ResponseStatusDetailsCopyWithImpl<$Res,
        $Val extends ResponseStatusDetails>
    implements $ResponseStatusDetailsCopyWith<$Res> {
  _$ResponseStatusDetailsCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of ResponseStatusDetails
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
  }) {
    return _then(_value.copyWith(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ResponseStatusType,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$ResponseStatusDetailsCancelledImplCopyWith<$Res>
    implements $ResponseStatusDetailsCopyWith<$Res> {
  factory _$$ResponseStatusDetailsCancelledImplCopyWith(
          _$ResponseStatusDetailsCancelledImpl value,
          $Res Function(_$ResponseStatusDetailsCancelledImpl) then) =
      __$$ResponseStatusDetailsCancelledImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {ResponseStatusType type,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      ResponseStatusIncompleteReason? reason});
}

/// @nodoc
class __$$ResponseStatusDetailsCancelledImplCopyWithImpl<$Res>
    extends _$ResponseStatusDetailsCopyWithImpl<$Res,
        _$ResponseStatusDetailsCancelledImpl>
    implements _$$ResponseStatusDetailsCancelledImplCopyWith<$Res> {
  __$$ResponseStatusDetailsCancelledImplCopyWithImpl(
      _$ResponseStatusDetailsCancelledImpl _value,
      $Res Function(_$ResponseStatusDetailsCancelledImpl) _then)
      : super(_value, _then);

  /// Create a copy of ResponseStatusDetails
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? reason = freezed,
  }) {
    return _then(_$ResponseStatusDetailsCancelledImpl(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ResponseStatusType,
      reason: freezed == reason
          ? _value.reason
          : reason // ignore: cast_nullable_to_non_nullable
              as ResponseStatusIncompleteReason?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ResponseStatusDetailsCancelledImpl
    extends ResponseStatusDetailsCancelled {
  const _$ResponseStatusDetailsCancelledImpl(
      {this.type = ResponseStatusType.cancelled,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.reason})
      : super._();

  factory _$ResponseStatusDetailsCancelledImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$ResponseStatusDetailsCancelledImplFromJson(json);

  /// The type of error that caused the response to fail.
  @override
  @JsonKey()
  final ResponseStatusType type;

  /// The reason the Response did not complete. For a `cancelled` Response, one of `turn_detected`
  /// (the server VAD detected a new start of speech) or `client_cancelled` (the client sent a
  /// cancel event). For an `incomplete` Response, one of `max_output_tokens` or `content_filter`
  /// (the server-side safety filter activated and cut off the response).
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final ResponseStatusIncompleteReason? reason;

  @override
  String toString() {
    return 'ResponseStatusDetails.cancelled(type: $type, reason: $reason)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ResponseStatusDetailsCancelledImpl &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.reason, reason) || other.reason == reason));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, type, reason);

  /// Create a copy of ResponseStatusDetails
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ResponseStatusDetailsCancelledImplCopyWith<
          _$ResponseStatusDetailsCancelledImpl>
      get copyWith => __$$ResponseStatusDetailsCancelledImplCopyWithImpl<
          _$ResponseStatusDetailsCancelledImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)
        cancelled,
    required TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)
        incomplete,
    required TResult Function(ResponseStatusType type,
            @JsonKey(includeIfNull: false) APIError? error)
        failed,
  }) {
    return cancelled(type, reason);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        cancelled,
    TResult? Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        incomplete,
    TResult? Function(ResponseStatusType type,
            @JsonKey(includeIfNull: false) APIError? error)?
        failed,
  }) {
    return cancelled?.call(type, reason);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        cancelled,
    TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        incomplete,
    TResult Function(ResponseStatusType type,
            @JsonKey(includeIfNull: false) APIError? error)?
        failed,
    required TResult orElse(),
  }) {
    if (cancelled != null) {
      return cancelled(type, reason);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ResponseStatusDetailsCancelled value) cancelled,
    required TResult Function(ResponseStatusDetailsIncomplete value) incomplete,
    required TResult Function(ResponseStatusDetailsFailed value) failed,
  }) {
    return cancelled(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ResponseStatusDetailsCancelled value)? cancelled,
    TResult? Function(ResponseStatusDetailsIncomplete value)? incomplete,
    TResult? Function(ResponseStatusDetailsFailed value)? failed,
  }) {
    return cancelled?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ResponseStatusDetailsCancelled value)? cancelled,
    TResult Function(ResponseStatusDetailsIncomplete value)? incomplete,
    TResult Function(ResponseStatusDetailsFailed value)? failed,
    required TResult orElse(),
  }) {
    if (cancelled != null) {
      return cancelled(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$ResponseStatusDetailsCancelledImplToJson(
      this,
    );
  }
}

abstract class ResponseStatusDetailsCancelled extends ResponseStatusDetails {
  const factory ResponseStatusDetailsCancelled(
          {final ResponseStatusType type,
          @JsonKey(
              includeIfNull: false,
              unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
          final ResponseStatusIncompleteReason? reason}) =
      _$ResponseStatusDetailsCancelledImpl;
  const ResponseStatusDetailsCancelled._() : super._();

  factory ResponseStatusDetailsCancelled.fromJson(Map<String, dynamic> json) =
      _$ResponseStatusDetailsCancelledImpl.fromJson;

  /// The type of error that caused the response to fail.
  @override
  ResponseStatusType get type;

  /// The reason the Response did not complete. For a `cancelled` Response, one of `turn_detected`
  /// (the server VAD detected a new start of speech) or `client_cancelled` (the client sent a
  /// cancel event). For an `incomplete` Response, one of `max_output_tokens` or `content_filter`
  /// (the server-side safety filter activated and cut off the response).
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  ResponseStatusIncompleteReason? get reason;

  /// Create a copy of ResponseStatusDetails
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ResponseStatusDetailsCancelledImplCopyWith<
          _$ResponseStatusDetailsCancelledImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$ResponseStatusDetailsIncompleteImplCopyWith<$Res>
    implements $ResponseStatusDetailsCopyWith<$Res> {
  factory _$$ResponseStatusDetailsIncompleteImplCopyWith(
          _$ResponseStatusDetailsIncompleteImpl value,
          $Res Function(_$ResponseStatusDetailsIncompleteImpl) then) =
      __$$ResponseStatusDetailsIncompleteImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {ResponseStatusType type,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      ResponseStatusIncompleteReason? reason});
}

/// @nodoc
class __$$ResponseStatusDetailsIncompleteImplCopyWithImpl<$Res>
    extends _$ResponseStatusDetailsCopyWithImpl<$Res,
        _$ResponseStatusDetailsIncompleteImpl>
    implements _$$ResponseStatusDetailsIncompleteImplCopyWith<$Res> {
  __$$ResponseStatusDetailsIncompleteImplCopyWithImpl(
      _$ResponseStatusDetailsIncompleteImpl _value,
      $Res Function(_$ResponseStatusDetailsIncompleteImpl) _then)
      : super(_value, _then);

  /// Create a copy of ResponseStatusDetails
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? reason = freezed,
  }) {
    return _then(_$ResponseStatusDetailsIncompleteImpl(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ResponseStatusType,
      reason: freezed == reason
          ? _value.reason
          : reason // ignore: cast_nullable_to_non_nullable
              as ResponseStatusIncompleteReason?,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$ResponseStatusDetailsIncompleteImpl
    extends ResponseStatusDetailsIncomplete {
  const _$ResponseStatusDetailsIncompleteImpl(
      {this.type = ResponseStatusType.incomplete,
      @JsonKey(
          includeIfNull: false,
          unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
      this.reason})
      : super._();

  factory _$ResponseStatusDetailsIncompleteImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$ResponseStatusDetailsIncompleteImplFromJson(json);

  /// The type of error that caused the response to fail.
  @override
  @JsonKey()
  final ResponseStatusType type;

  /// The reason the Response did not complete. For a `cancelled` Response, one of `turn_detected`
  /// (the server VAD detected a new start of speech) or `client_cancelled` (the client sent a
  /// cancel event). For an `incomplete` Response, one of `max_output_tokens` or `content_filter`
  /// (the server-side safety filter activated and cut off the response).
  @override
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  final ResponseStatusIncompleteReason? reason;

  @override
  String toString() {
    return 'ResponseStatusDetails.incomplete(type: $type, reason: $reason)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ResponseStatusDetailsIncompleteImpl &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.reason, reason) || other.reason == reason));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, type, reason);

  /// Create a copy of ResponseStatusDetails
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ResponseStatusDetailsIncompleteImplCopyWith<
          _$ResponseStatusDetailsIncompleteImpl>
      get copyWith => __$$ResponseStatusDetailsIncompleteImplCopyWithImpl<
          _$ResponseStatusDetailsIncompleteImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)
        cancelled,
    required TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)
        incomplete,
    required TResult Function(ResponseStatusType type,
            @JsonKey(includeIfNull: false) APIError? error)
        failed,
  }) {
    return incomplete(type, reason);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        cancelled,
    TResult? Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        incomplete,
    TResult? Function(ResponseStatusType type,
            @JsonKey(includeIfNull: false) APIError? error)?
        failed,
  }) {
    return incomplete?.call(type, reason);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        cancelled,
    TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        incomplete,
    TResult Function(ResponseStatusType type,
            @JsonKey(includeIfNull: false) APIError? error)?
        failed,
    required TResult orElse(),
  }) {
    if (incomplete != null) {
      return incomplete(type, reason);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ResponseStatusDetailsCancelled value) cancelled,
    required TResult Function(ResponseStatusDetailsIncomplete value) incomplete,
    required TResult Function(ResponseStatusDetailsFailed value) failed,
  }) {
    return incomplete(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ResponseStatusDetailsCancelled value)? cancelled,
    TResult? Function(ResponseStatusDetailsIncomplete value)? incomplete,
    TResult? Function(ResponseStatusDetailsFailed value)? failed,
  }) {
    return incomplete?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ResponseStatusDetailsCancelled value)? cancelled,
    TResult Function(ResponseStatusDetailsIncomplete value)? incomplete,
    TResult Function(ResponseStatusDetailsFailed value)? failed,
    required TResult orElse(),
  }) {
    if (incomplete != null) {
      return incomplete(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$ResponseStatusDetailsIncompleteImplToJson(
      this,
    );
  }
}

abstract class ResponseStatusDetailsIncomplete extends ResponseStatusDetails {
  const factory ResponseStatusDetailsIncomplete(
          {final ResponseStatusType type,
          @JsonKey(
              includeIfNull: false,
              unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
          final ResponseStatusIncompleteReason? reason}) =
      _$ResponseStatusDetailsIncompleteImpl;
  const ResponseStatusDetailsIncomplete._() : super._();

  factory ResponseStatusDetailsIncomplete.fromJson(Map<String, dynamic> json) =
      _$ResponseStatusDetailsIncompleteImpl.fromJson;

  /// The type of error that caused the response to fail.
  @override
  ResponseStatusType get type;

  /// The reason the Response did not complete. For a `cancelled` Response, one of `turn_detected`
  /// (the server VAD detected a new start of speech) or `client_cancelled` (the client sent a
  /// cancel event). For an `incomplete` Response, one of `max_output_tokens` or `content_filter`
  /// (the server-side safety filter activated and cut off the response).
  @JsonKey(
      includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
  ResponseStatusIncompleteReason? get reason;

  /// Create a copy of ResponseStatusDetails
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ResponseStatusDetailsIncompleteImplCopyWith<
          _$ResponseStatusDetailsIncompleteImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$ResponseStatusDetailsFailedImplCopyWith<$Res>
    implements $ResponseStatusDetailsCopyWith<$Res> {
  factory _$$ResponseStatusDetailsFailedImplCopyWith(
          _$ResponseStatusDetailsFailedImpl value,
          $Res Function(_$ResponseStatusDetailsFailedImpl) then) =
      __$$ResponseStatusDetailsFailedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {ResponseStatusType type,
      @JsonKey(includeIfNull: false) APIError? error});

  $APIErrorCopyWith<$Res>? get error;
}

/// @nodoc
class __$$ResponseStatusDetailsFailedImplCopyWithImpl<$Res>
    extends _$ResponseStatusDetailsCopyWithImpl<$Res,
        _$ResponseStatusDetailsFailedImpl>
    implements _$$ResponseStatusDetailsFailedImplCopyWith<$Res> {
  __$$ResponseStatusDetailsFailedImplCopyWithImpl(
      _$ResponseStatusDetailsFailedImpl _value,
      $Res Function(_$ResponseStatusDetailsFailedImpl) _then)
      : super(_value, _then);

  /// Create a copy of ResponseStatusDetails
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? type = null,
    Object? error = freezed,
  }) {
    return _then(_$ResponseStatusDetailsFailedImpl(
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as ResponseStatusType,
      error: freezed == error
          ? _value.error
          : error // ignore: cast_nullable_to_non_nullable
              as APIError?,
    ));
  }

  /// Create a copy of ResponseStatusDetails
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $APIErrorCopyWith<$Res>? get error {
    if (_value.error == null) {
      return null;
    }

    return $APIErrorCopyWith<$Res>(_value.error!, (value) {
      return _then(_value.copyWith(error: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$ResponseStatusDetailsFailedImpl extends ResponseStatusDetailsFailed {
  const _$ResponseStatusDetailsFailedImpl(
      {this.type = ResponseStatusType.failed,
      @JsonKey(includeIfNull: false) this.error})
      : super._();

  factory _$ResponseStatusDetailsFailedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$ResponseStatusDetailsFailedImplFromJson(json);

  /// The type of error that caused the response to fail.
  @override
  @JsonKey()
  final ResponseStatusType type;

  /// Details of the API error.
  @override
  @JsonKey(includeIfNull: false)
  final APIError? error;

  @override
  String toString() {
    return 'ResponseStatusDetails.failed(type: $type, error: $error)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$ResponseStatusDetailsFailedImpl &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.error, error) || other.error == error));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, type, error);

  /// Create a copy of ResponseStatusDetails
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$ResponseStatusDetailsFailedImplCopyWith<_$ResponseStatusDetailsFailedImpl>
      get copyWith => __$$ResponseStatusDetailsFailedImplCopyWithImpl<
          _$ResponseStatusDetailsFailedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)
        cancelled,
    required TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)
        incomplete,
    required TResult Function(ResponseStatusType type,
            @JsonKey(includeIfNull: false) APIError? error)
        failed,
  }) {
    return failed(type, error);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        cancelled,
    TResult? Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        incomplete,
    TResult? Function(ResponseStatusType type,
            @JsonKey(includeIfNull: false) APIError? error)?
        failed,
  }) {
    return failed?.call(type, error);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        cancelled,
    TResult Function(
            ResponseStatusType type,
            @JsonKey(
                includeIfNull: false,
                unknownEnumValue: JsonKey.nullForUndefinedEnumValue)
            ResponseStatusIncompleteReason? reason)?
        incomplete,
    TResult Function(ResponseStatusType type,
            @JsonKey(includeIfNull: false) APIError? error)?
        failed,
    required TResult orElse(),
  }) {
    if (failed != null) {
      return failed(type, error);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(ResponseStatusDetailsCancelled value) cancelled,
    required TResult Function(ResponseStatusDetailsIncomplete value) incomplete,
    required TResult Function(ResponseStatusDetailsFailed value) failed,
  }) {
    return failed(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(ResponseStatusDetailsCancelled value)? cancelled,
    TResult? Function(ResponseStatusDetailsIncomplete value)? incomplete,
    TResult? Function(ResponseStatusDetailsFailed value)? failed,
  }) {
    return failed?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(ResponseStatusDetailsCancelled value)? cancelled,
    TResult Function(ResponseStatusDetailsIncomplete value)? incomplete,
    TResult Function(ResponseStatusDetailsFailed value)? failed,
    required TResult orElse(),
  }) {
    if (failed != null) {
      return failed(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$ResponseStatusDetailsFailedImplToJson(
      this,
    );
  }
}

abstract class ResponseStatusDetailsFailed extends ResponseStatusDetails {
  const factory ResponseStatusDetailsFailed(
          {final ResponseStatusType type,
          @JsonKey(includeIfNull: false) final APIError? error}) =
      _$ResponseStatusDetailsFailedImpl;
  const ResponseStatusDetailsFailed._() : super._();

  factory ResponseStatusDetailsFailed.fromJson(Map<String, dynamic> json) =
      _$ResponseStatusDetailsFailedImpl.fromJson;

  /// The type of error that caused the response to fail.
  @override
  ResponseStatusType get type;

  /// Details of the API error.
  @JsonKey(includeIfNull: false)
  APIError? get error;

  /// Create a copy of ResponseStatusDetails
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$ResponseStatusDetailsFailedImplCopyWith<_$ResponseStatusDetailsFailedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

RealtimeEvent _$RealtimeEventFromJson(Map<String, dynamic> json) {
  switch (json['type']) {
    case 'conversation.item.create':
      return RealtimeEventConversationItemCreate.fromJson(json);
    case 'conversation.item.delete':
      return RealtimeEventConversationItemDelete.fromJson(json);
    case 'conversation.item.truncate':
      return RealtimeEventConversationItemTruncate.fromJson(json);
    case 'input_audio_buffer.append':
      return RealtimeEventInputAudioBufferAppend.fromJson(json);
    case 'input_audio_buffer.clear':
      return RealtimeEventInputAudioBufferClear.fromJson(json);
    case 'input_audio_buffer.commit':
      return RealtimeEventInputAudioBufferCommit.fromJson(json);
    case 'response.cancel':
      return RealtimeEventResponseCancel.fromJson(json);
    case 'response.create':
      return RealtimeEventResponseCreate.fromJson(json);
    case 'session.update':
      return RealtimeEventSessionUpdate.fromJson(json);
    case 'conversation.created':
      return RealtimeEventConversationCreated.fromJson(json);
    case 'conversation.item.created':
      return RealtimeEventConversationItemCreated.fromJson(json);
    case 'conversation.item.deleted':
      return RealtimeEventConversationItemDeleted.fromJson(json);
    case 'conversation.item.input_audio_transcription.completed':
      return RealtimeEventConversationItemInputAudioTranscriptionCompleted
          .fromJson(json);
    case 'conversation.item.input_audio_transcription.failed':
      return RealtimeEventConversationItemInputAudioTranscriptionFailed
          .fromJson(json);
    case 'conversation.item.truncated':
      return RealtimeEventConversationItemTruncated.fromJson(json);
    case 'error':
      return RealtimeEventError.fromJson(json);
    case 'input_audio_buffer.cleared':
      return RealtimeEventInputAudioBufferCleared.fromJson(json);
    case 'input_audio_buffer.committed':
      return RealtimeEventInputAudioBufferCommitted.fromJson(json);
    case 'input_audio_buffer.speech_started':
      return RealtimeEventInputAudioBufferSpeechStarted.fromJson(json);
    case 'input_audio_buffer.speech_stopped':
      return RealtimeEventInputAudioBufferSpeechStopped.fromJson(json);
    case 'rate_limits.updated':
      return RealtimeEventRateLimitsUpdated.fromJson(json);
    case 'response.audio.delta':
      return RealtimeEventResponseAudioDelta.fromJson(json);
    case 'response.audio.done':
      return RealtimeEventResponseAudioDone.fromJson(json);
    case 'response.audio_transcript.delta':
      return RealtimeEventResponseAudioTranscriptDelta.fromJson(json);
    case 'response.audio_transcript.done':
      return RealtimeEventResponseAudioTranscriptDone.fromJson(json);
    case 'response.content_part.added':
      return RealtimeEventResponseContentPartAdded.fromJson(json);
    case 'response.content_part.done':
      return RealtimeEventResponseContentPartDone.fromJson(json);
    case 'response.created':
      return RealtimeEventResponseCreated.fromJson(json);
    case 'response.done':
      return RealtimeEventResponseDone.fromJson(json);
    case 'response.function_call_arguments.delta':
      return RealtimeEventResponseFunctionCallArgumentsDelta.fromJson(json);
    case 'response.function_call_arguments.done':
      return RealtimeEventResponseFunctionCallArgumentsDone.fromJson(json);
    case 'response.output_item.added':
      return RealtimeEventResponseOutputItemAdded.fromJson(json);
    case 'response.output_item.done':
      return RealtimeEventResponseOutputItemDone.fromJson(json);
    case 'response.text.delta':
      return RealtimeEventResponseTextDelta.fromJson(json);
    case 'response.text.done':
      return RealtimeEventResponseTextDone.fromJson(json);
    case 'session.created':
      return RealtimeEventSessionCreated.fromJson(json);
    case 'session.updated':
      return RealtimeEventSessionUpdated.fromJson(json);
    case 'close':
      return RealtimeEventClose.fromJson(json);
    case 'conversation.interrupted':
      return RealtimeEventConversationInterrupted.fromJson(json);
    case 'conversation.updated':
      return RealtimeEventConversationUpdated.fromJson(json);
    case 'conversation.item.appended':
      return RealtimeEventConversationItemAppended.fromJson(json);
    case 'conversation.item.completed':
      return RealtimeEventConversationItemCompleted.fromJson(json);
    case 'realtime.event':
      return RealtimeEventGeneric.fromJson(json);

    default:
      throw CheckedFromJsonException(json, 'type', 'RealtimeEvent',
          'Invalid union type "${json['type']}"!');
  }
}

/// @nodoc
mixin _$RealtimeEvent {
  /// Optional client-generated ID used to identify this event.
  @JsonKey(name: 'event_id')
  String? get eventId => throw _privateConstructorUsedError;

  /// The type of the event.
  RealtimeEventType get type => throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) =>
      throw _privateConstructorUsedError;
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) =>
      throw _privateConstructorUsedError;

  /// Serializes this RealtimeEvent to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $RealtimeEventCopyWith<RealtimeEvent> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $RealtimeEventCopyWith<$Res> {
  factory $RealtimeEventCopyWith(
          RealtimeEvent value, $Res Function(RealtimeEvent) then) =
      _$RealtimeEventCopyWithImpl<$Res, RealtimeEvent>;
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId, RealtimeEventType type});
}

/// @nodoc
class _$RealtimeEventCopyWithImpl<$Res, $Val extends RealtimeEvent>
    implements $RealtimeEventCopyWith<$Res> {
  _$RealtimeEventCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
  }) {
    return _then(_value.copyWith(
      eventId: null == eventId
          ? _value.eventId!
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$RealtimeEventConversationItemCreateImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventConversationItemCreateImplCopyWith(
          _$RealtimeEventConversationItemCreateImpl value,
          $Res Function(_$RealtimeEventConversationItemCreateImpl) then) =
      __$$RealtimeEventConversationItemCreateImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'previous_item_id', includeIfNull: false)
      String? previousItemId,
      Item item});

  $ItemCopyWith<$Res> get item;
}

/// @nodoc
class __$$RealtimeEventConversationItemCreateImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventConversationItemCreateImpl>
    implements _$$RealtimeEventConversationItemCreateImplCopyWith<$Res> {
  __$$RealtimeEventConversationItemCreateImplCopyWithImpl(
      _$RealtimeEventConversationItemCreateImpl _value,
      $Res Function(_$RealtimeEventConversationItemCreateImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? previousItemId = freezed,
    Object? item = null,
  }) {
    return _then(_$RealtimeEventConversationItemCreateImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      previousItemId: freezed == previousItemId
          ? _value.previousItemId
          : previousItemId // ignore: cast_nullable_to_non_nullable
              as String?,
      item: null == item
          ? _value.item
          : item // ignore: cast_nullable_to_non_nullable
              as Item,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ItemCopyWith<$Res> get item {
    return $ItemCopyWith<$Res>(_value.item, (value) {
      return _then(_value.copyWith(item: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventConversationItemCreateImpl
    extends RealtimeEventConversationItemCreate {
  const _$RealtimeEventConversationItemCreateImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.conversationItemCreate,
      @JsonKey(name: 'previous_item_id', includeIfNull: false)
      this.previousItemId,
      required this.item})
      : super._();

  factory _$RealtimeEventConversationItemCreateImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventConversationItemCreateImplFromJson(json);

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the preceding item after which the new item will be inserted. If not set, the new item
  /// will be appended to the end of the conversation. If set, it allows an item to be inserted
  /// mid-conversation. If the ID cannot be found, an error will be returned and the item will not be
  /// added.
  @override
  @JsonKey(name: 'previous_item_id', includeIfNull: false)
  final String? previousItemId;

  /// The item to add to the conversation.
  /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput]
  @override
  final Item item;

  @override
  String toString() {
    return 'RealtimeEvent.conversationItemCreate(eventId: $eventId, type: $type, previousItemId: $previousItemId, item: $item)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventConversationItemCreateImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.previousItemId, previousItemId) ||
                other.previousItemId == previousItemId) &&
            (identical(other.item, item) || other.item == item));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, eventId, type, previousItemId, item);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventConversationItemCreateImplCopyWith<
          _$RealtimeEventConversationItemCreateImpl>
      get copyWith => __$$RealtimeEventConversationItemCreateImplCopyWithImpl<
          _$RealtimeEventConversationItemCreateImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return conversationItemCreate(eventId, type, previousItemId, item);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return conversationItemCreate?.call(eventId, type, previousItemId, item);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (conversationItemCreate != null) {
      return conversationItemCreate(eventId, type, previousItemId, item);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return conversationItemCreate(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return conversationItemCreate?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (conversationItemCreate != null) {
      return conversationItemCreate(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventConversationItemCreateImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventConversationItemCreate extends RealtimeEvent {
  const factory RealtimeEventConversationItemCreate(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      @JsonKey(name: 'previous_item_id', includeIfNull: false)
      final String? previousItemId,
      required final Item item}) = _$RealtimeEventConversationItemCreateImpl;
  const RealtimeEventConversationItemCreate._() : super._();

  factory RealtimeEventConversationItemCreate.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventConversationItemCreateImpl.fromJson;

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the preceding item after which the new item will be inserted. If not set, the new item
  /// will be appended to the end of the conversation. If set, it allows an item to be inserted
  /// mid-conversation. If the ID cannot be found, an error will be returned and the item will not be
  /// added.
  @JsonKey(name: 'previous_item_id', includeIfNull: false)
  String? get previousItemId;

  /// The item to add to the conversation.
  /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput]
  Item get item;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventConversationItemCreateImplCopyWith<
          _$RealtimeEventConversationItemCreateImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventConversationItemDeleteImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventConversationItemDeleteImplCopyWith(
          _$RealtimeEventConversationItemDeleteImpl value,
          $Res Function(_$RealtimeEventConversationItemDeleteImpl) then) =
      __$$RealtimeEventConversationItemDeleteImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'item_id') String itemId});
}

/// @nodoc
class __$$RealtimeEventConversationItemDeleteImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventConversationItemDeleteImpl>
    implements _$$RealtimeEventConversationItemDeleteImplCopyWith<$Res> {
  __$$RealtimeEventConversationItemDeleteImplCopyWithImpl(
      _$RealtimeEventConversationItemDeleteImpl _value,
      $Res Function(_$RealtimeEventConversationItemDeleteImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? itemId = null,
  }) {
    return _then(_$RealtimeEventConversationItemDeleteImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventConversationItemDeleteImpl
    extends RealtimeEventConversationItemDelete {
  const _$RealtimeEventConversationItemDeleteImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.conversationItemDelete,
      @JsonKey(name: 'item_id') required this.itemId})
      : super._();

  factory _$RealtimeEventConversationItemDeleteImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventConversationItemDeleteImplFromJson(json);

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the item to delete.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  @override
  String toString() {
    return 'RealtimeEvent.conversationItemDelete(eventId: $eventId, type: $type, itemId: $itemId)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventConversationItemDeleteImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.itemId, itemId) || other.itemId == itemId));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, itemId);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventConversationItemDeleteImplCopyWith<
          _$RealtimeEventConversationItemDeleteImpl>
      get copyWith => __$$RealtimeEventConversationItemDeleteImplCopyWithImpl<
          _$RealtimeEventConversationItemDeleteImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return conversationItemDelete(eventId, type, itemId);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return conversationItemDelete?.call(eventId, type, itemId);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (conversationItemDelete != null) {
      return conversationItemDelete(eventId, type, itemId);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return conversationItemDelete(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return conversationItemDelete?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (conversationItemDelete != null) {
      return conversationItemDelete(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventConversationItemDeleteImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventConversationItemDelete extends RealtimeEvent {
  const factory RealtimeEventConversationItemDelete(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'item_id') required final String itemId}) =
      _$RealtimeEventConversationItemDeleteImpl;
  const RealtimeEventConversationItemDelete._() : super._();

  factory RealtimeEventConversationItemDelete.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventConversationItemDeleteImpl.fromJson;

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the item to delete.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventConversationItemDeleteImplCopyWith<
          _$RealtimeEventConversationItemDeleteImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventConversationItemTruncateImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventConversationItemTruncateImplCopyWith(
          _$RealtimeEventConversationItemTruncateImpl value,
          $Res Function(_$RealtimeEventConversationItemTruncateImpl) then) =
      __$$RealtimeEventConversationItemTruncateImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'item_id') String itemId,
      @JsonKey(name: 'content_index') int contentIndex,
      @JsonKey(name: 'audio_end_ms') int audioEndMs});
}

/// @nodoc
class __$$RealtimeEventConversationItemTruncateImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventConversationItemTruncateImpl>
    implements _$$RealtimeEventConversationItemTruncateImplCopyWith<$Res> {
  __$$RealtimeEventConversationItemTruncateImplCopyWithImpl(
      _$RealtimeEventConversationItemTruncateImpl _value,
      $Res Function(_$RealtimeEventConversationItemTruncateImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? itemId = null,
    Object? contentIndex = null,
    Object? audioEndMs = null,
  }) {
    return _then(_$RealtimeEventConversationItemTruncateImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
      contentIndex: null == contentIndex
          ? _value.contentIndex
          : contentIndex // ignore: cast_nullable_to_non_nullable
              as int,
      audioEndMs: null == audioEndMs
          ? _value.audioEndMs
          : audioEndMs // ignore: cast_nullable_to_non_nullable
              as int,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventConversationItemTruncateImpl
    extends RealtimeEventConversationItemTruncate {
  const _$RealtimeEventConversationItemTruncateImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.conversationItemTruncate,
      @JsonKey(name: 'item_id') required this.itemId,
      @JsonKey(name: 'content_index') required this.contentIndex,
      @JsonKey(name: 'audio_end_ms') required this.audioEndMs})
      : super._();

  factory _$RealtimeEventConversationItemTruncateImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventConversationItemTruncateImplFromJson(json);

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the assistant message item to truncate. Only assistant message items can be truncated.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  /// The index of the content part to truncate. Set this to 0.
  @override
  @JsonKey(name: 'content_index')
  final int contentIndex;

  /// Inclusive duration up to which audio is truncated, in milliseconds. If the audio_end_ms is greater
  /// than the actual audio duration, the server will respond with an error.
  @override
  @JsonKey(name: 'audio_end_ms')
  final int audioEndMs;

  @override
  String toString() {
    return 'RealtimeEvent.conversationItemTruncate(eventId: $eventId, type: $type, itemId: $itemId, contentIndex: $contentIndex, audioEndMs: $audioEndMs)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventConversationItemTruncateImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.itemId, itemId) || other.itemId == itemId) &&
            (identical(other.contentIndex, contentIndex) ||
                other.contentIndex == contentIndex) &&
            (identical(other.audioEndMs, audioEndMs) ||
                other.audioEndMs == audioEndMs));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, eventId, type, itemId, contentIndex, audioEndMs);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventConversationItemTruncateImplCopyWith<
          _$RealtimeEventConversationItemTruncateImpl>
      get copyWith => __$$RealtimeEventConversationItemTruncateImplCopyWithImpl<
          _$RealtimeEventConversationItemTruncateImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return conversationItemTruncate(
        eventId, type, itemId, contentIndex, audioEndMs);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return conversationItemTruncate?.call(
        eventId, type, itemId, contentIndex, audioEndMs);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (conversationItemTruncate != null) {
      return conversationItemTruncate(
          eventId, type, itemId, contentIndex, audioEndMs);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return conversationItemTruncate(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return conversationItemTruncate?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (conversationItemTruncate != null) {
      return conversationItemTruncate(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventConversationItemTruncateImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventConversationItemTruncate extends RealtimeEvent {
  const factory RealtimeEventConversationItemTruncate(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'item_id') required final String itemId,
          @JsonKey(name: 'content_index') required final int contentIndex,
          @JsonKey(name: 'audio_end_ms') required final int audioEndMs}) =
      _$RealtimeEventConversationItemTruncateImpl;
  const RealtimeEventConversationItemTruncate._() : super._();

  factory RealtimeEventConversationItemTruncate.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventConversationItemTruncateImpl.fromJson;

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the assistant message item to truncate. Only assistant message items can be truncated.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// The index of the content part to truncate. Set this to 0.
  @JsonKey(name: 'content_index')
  int get contentIndex;

  /// Inclusive duration up to which audio is truncated, in milliseconds. If the audio_end_ms is greater
  /// than the actual audio duration, the server will respond with an error.
  @JsonKey(name: 'audio_end_ms')
  int get audioEndMs;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventConversationItemTruncateImplCopyWith<
          _$RealtimeEventConversationItemTruncateImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventInputAudioBufferAppendImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventInputAudioBufferAppendImplCopyWith(
          _$RealtimeEventInputAudioBufferAppendImpl value,
          $Res Function(_$RealtimeEventInputAudioBufferAppendImpl) then) =
      __$$RealtimeEventInputAudioBufferAppendImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      String audio});
}

/// @nodoc
class __$$RealtimeEventInputAudioBufferAppendImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventInputAudioBufferAppendImpl>
    implements _$$RealtimeEventInputAudioBufferAppendImplCopyWith<$Res> {
  __$$RealtimeEventInputAudioBufferAppendImplCopyWithImpl(
      _$RealtimeEventInputAudioBufferAppendImpl _value,
      $Res Function(_$RealtimeEventInputAudioBufferAppendImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? audio = null,
  }) {
    return _then(_$RealtimeEventInputAudioBufferAppendImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      audio: null == audio
          ? _value.audio
          : audio // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventInputAudioBufferAppendImpl
    extends RealtimeEventInputAudioBufferAppend {
  const _$RealtimeEventInputAudioBufferAppendImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.inputAudioBufferAppend,
      required this.audio})
      : super._();

  factory _$RealtimeEventInputAudioBufferAppendImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventInputAudioBufferAppendImplFromJson(json);

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// Base64-encoded audio bytes. This must be in the format specified by the `input_audio_format` field
  /// in the session configuration.
  @override
  final String audio;

  @override
  String toString() {
    return 'RealtimeEvent.inputAudioBufferAppend(eventId: $eventId, type: $type, audio: $audio)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventInputAudioBufferAppendImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.audio, audio) || other.audio == audio));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, audio);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventInputAudioBufferAppendImplCopyWith<
          _$RealtimeEventInputAudioBufferAppendImpl>
      get copyWith => __$$RealtimeEventInputAudioBufferAppendImplCopyWithImpl<
          _$RealtimeEventInputAudioBufferAppendImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return inputAudioBufferAppend(eventId, type, audio);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return inputAudioBufferAppend?.call(eventId, type, audio);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (inputAudioBufferAppend != null) {
      return inputAudioBufferAppend(eventId, type, audio);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return inputAudioBufferAppend(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return inputAudioBufferAppend?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (inputAudioBufferAppend != null) {
      return inputAudioBufferAppend(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventInputAudioBufferAppendImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventInputAudioBufferAppend extends RealtimeEvent {
  const factory RealtimeEventInputAudioBufferAppend(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      required final String audio}) = _$RealtimeEventInputAudioBufferAppendImpl;
  const RealtimeEventInputAudioBufferAppend._() : super._();

  factory RealtimeEventInputAudioBufferAppend.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventInputAudioBufferAppendImpl.fromJson;

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// Base64-encoded audio bytes. This must be in the format specified by the `input_audio_format` field
  /// in the session configuration.
  String get audio;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventInputAudioBufferAppendImplCopyWith<
          _$RealtimeEventInputAudioBufferAppendImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventInputAudioBufferClearImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventInputAudioBufferClearImplCopyWith(
          _$RealtimeEventInputAudioBufferClearImpl value,
          $Res Function(_$RealtimeEventInputAudioBufferClearImpl) then) =
      __$$RealtimeEventInputAudioBufferClearImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId, RealtimeEventType type});
}

/// @nodoc
class __$$RealtimeEventInputAudioBufferClearImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventInputAudioBufferClearImpl>
    implements _$$RealtimeEventInputAudioBufferClearImplCopyWith<$Res> {
  __$$RealtimeEventInputAudioBufferClearImplCopyWithImpl(
      _$RealtimeEventInputAudioBufferClearImpl _value,
      $Res Function(_$RealtimeEventInputAudioBufferClearImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
  }) {
    return _then(_$RealtimeEventInputAudioBufferClearImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventInputAudioBufferClearImpl
    extends RealtimeEventInputAudioBufferClear {
  const _$RealtimeEventInputAudioBufferClearImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.inputAudioBufferClear})
      : super._();

  factory _$RealtimeEventInputAudioBufferClearImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventInputAudioBufferClearImplFromJson(json);

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  @override
  String toString() {
    return 'RealtimeEvent.inputAudioBufferClear(eventId: $eventId, type: $type)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventInputAudioBufferClearImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventInputAudioBufferClearImplCopyWith<
          _$RealtimeEventInputAudioBufferClearImpl>
      get copyWith => __$$RealtimeEventInputAudioBufferClearImplCopyWithImpl<
          _$RealtimeEventInputAudioBufferClearImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return inputAudioBufferClear(eventId, type);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return inputAudioBufferClear?.call(eventId, type);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (inputAudioBufferClear != null) {
      return inputAudioBufferClear(eventId, type);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return inputAudioBufferClear(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return inputAudioBufferClear?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (inputAudioBufferClear != null) {
      return inputAudioBufferClear(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventInputAudioBufferClearImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventInputAudioBufferClear extends RealtimeEvent {
  const factory RealtimeEventInputAudioBufferClear(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type}) = _$RealtimeEventInputAudioBufferClearImpl;
  const RealtimeEventInputAudioBufferClear._() : super._();

  factory RealtimeEventInputAudioBufferClear.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventInputAudioBufferClearImpl.fromJson;

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventInputAudioBufferClearImplCopyWith<
          _$RealtimeEventInputAudioBufferClearImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventInputAudioBufferCommitImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventInputAudioBufferCommitImplCopyWith(
          _$RealtimeEventInputAudioBufferCommitImpl value,
          $Res Function(_$RealtimeEventInputAudioBufferCommitImpl) then) =
      __$$RealtimeEventInputAudioBufferCommitImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId, RealtimeEventType type});
}

/// @nodoc
class __$$RealtimeEventInputAudioBufferCommitImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventInputAudioBufferCommitImpl>
    implements _$$RealtimeEventInputAudioBufferCommitImplCopyWith<$Res> {
  __$$RealtimeEventInputAudioBufferCommitImplCopyWithImpl(
      _$RealtimeEventInputAudioBufferCommitImpl _value,
      $Res Function(_$RealtimeEventInputAudioBufferCommitImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
  }) {
    return _then(_$RealtimeEventInputAudioBufferCommitImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventInputAudioBufferCommitImpl
    extends RealtimeEventInputAudioBufferCommit {
  const _$RealtimeEventInputAudioBufferCommitImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.inputAudioBufferCommit})
      : super._();

  factory _$RealtimeEventInputAudioBufferCommitImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventInputAudioBufferCommitImplFromJson(json);

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  @override
  String toString() {
    return 'RealtimeEvent.inputAudioBufferCommit(eventId: $eventId, type: $type)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventInputAudioBufferCommitImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventInputAudioBufferCommitImplCopyWith<
          _$RealtimeEventInputAudioBufferCommitImpl>
      get copyWith => __$$RealtimeEventInputAudioBufferCommitImplCopyWithImpl<
          _$RealtimeEventInputAudioBufferCommitImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return inputAudioBufferCommit(eventId, type);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return inputAudioBufferCommit?.call(eventId, type);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (inputAudioBufferCommit != null) {
      return inputAudioBufferCommit(eventId, type);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return inputAudioBufferCommit(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return inputAudioBufferCommit?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (inputAudioBufferCommit != null) {
      return inputAudioBufferCommit(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventInputAudioBufferCommitImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventInputAudioBufferCommit extends RealtimeEvent {
  const factory RealtimeEventInputAudioBufferCommit(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type}) =
      _$RealtimeEventInputAudioBufferCommitImpl;
  const RealtimeEventInputAudioBufferCommit._() : super._();

  factory RealtimeEventInputAudioBufferCommit.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventInputAudioBufferCommitImpl.fromJson;

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventInputAudioBufferCommitImplCopyWith<
          _$RealtimeEventInputAudioBufferCommitImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseCancelImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseCancelImplCopyWith(
          _$RealtimeEventResponseCancelImpl value,
          $Res Function(_$RealtimeEventResponseCancelImpl) then) =
      __$$RealtimeEventResponseCancelImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId, RealtimeEventType type});
}

/// @nodoc
class __$$RealtimeEventResponseCancelImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventResponseCancelImpl>
    implements _$$RealtimeEventResponseCancelImplCopyWith<$Res> {
  __$$RealtimeEventResponseCancelImplCopyWithImpl(
      _$RealtimeEventResponseCancelImpl _value,
      $Res Function(_$RealtimeEventResponseCancelImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
  }) {
    return _then(_$RealtimeEventResponseCancelImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseCancelImpl extends RealtimeEventResponseCancel {
  const _$RealtimeEventResponseCancelImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseCancel})
      : super._();

  factory _$RealtimeEventResponseCancelImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseCancelImplFromJson(json);

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  @override
  String toString() {
    return 'RealtimeEvent.responseCancel(eventId: $eventId, type: $type)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseCancelImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseCancelImplCopyWith<_$RealtimeEventResponseCancelImpl>
      get copyWith => __$$RealtimeEventResponseCancelImplCopyWithImpl<
          _$RealtimeEventResponseCancelImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseCancel(eventId, type);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseCancel?.call(eventId, type);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseCancel != null) {
      return responseCancel(eventId, type);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseCancel(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseCancel?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseCancel != null) {
      return responseCancel(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseCancelImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseCancel extends RealtimeEvent {
  const factory RealtimeEventResponseCancel(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type}) = _$RealtimeEventResponseCancelImpl;
  const RealtimeEventResponseCancel._() : super._();

  factory RealtimeEventResponseCancel.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventResponseCancelImpl.fromJson;

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseCancelImplCopyWith<_$RealtimeEventResponseCancelImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseCreateImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseCreateImplCopyWith(
          _$RealtimeEventResponseCreateImpl value,
          $Res Function(_$RealtimeEventResponseCreateImpl) then) =
      __$$RealtimeEventResponseCreateImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(includeIfNull: false) ResponseConfig? response});

  $ResponseConfigCopyWith<$Res>? get response;
}

/// @nodoc
class __$$RealtimeEventResponseCreateImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventResponseCreateImpl>
    implements _$$RealtimeEventResponseCreateImplCopyWith<$Res> {
  __$$RealtimeEventResponseCreateImplCopyWithImpl(
      _$RealtimeEventResponseCreateImpl _value,
      $Res Function(_$RealtimeEventResponseCreateImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? response = freezed,
  }) {
    return _then(_$RealtimeEventResponseCreateImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      response: freezed == response
          ? _value.response
          : response // ignore: cast_nullable_to_non_nullable
              as ResponseConfig?,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ResponseConfigCopyWith<$Res>? get response {
    if (_value.response == null) {
      return null;
    }

    return $ResponseConfigCopyWith<$Res>(_value.response!, (value) {
      return _then(_value.copyWith(response: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseCreateImpl extends RealtimeEventResponseCreate {
  const _$RealtimeEventResponseCreateImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseCreate,
      @JsonKey(includeIfNull: false) this.response})
      : super._();

  factory _$RealtimeEventResponseCreateImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseCreateImplFromJson(json);

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// Configuration for the response.
  @override
  @JsonKey(includeIfNull: false)
  final ResponseConfig? response;

  @override
  String toString() {
    return 'RealtimeEvent.responseCreate(eventId: $eventId, type: $type, response: $response)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseCreateImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.response, response) ||
                other.response == response));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, response);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseCreateImplCopyWith<_$RealtimeEventResponseCreateImpl>
      get copyWith => __$$RealtimeEventResponseCreateImplCopyWithImpl<
          _$RealtimeEventResponseCreateImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseCreate(eventId, type, response);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseCreate?.call(eventId, type, response);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseCreate != null) {
      return responseCreate(eventId, type, response);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseCreate(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseCreate?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseCreate != null) {
      return responseCreate(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseCreateImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseCreate extends RealtimeEvent {
  const factory RealtimeEventResponseCreate(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(includeIfNull: false) final ResponseConfig? response}) =
      _$RealtimeEventResponseCreateImpl;
  const RealtimeEventResponseCreate._() : super._();

  factory RealtimeEventResponseCreate.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventResponseCreateImpl.fromJson;

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// Configuration for the response.
  @JsonKey(includeIfNull: false)
  ResponseConfig? get response;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseCreateImplCopyWith<_$RealtimeEventResponseCreateImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventSessionUpdateImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventSessionUpdateImplCopyWith(
          _$RealtimeEventSessionUpdateImpl value,
          $Res Function(_$RealtimeEventSessionUpdateImpl) then) =
      __$$RealtimeEventSessionUpdateImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
      RealtimeEventType type,
      SessionConfig session});

  $SessionConfigCopyWith<$Res> get session;
}

/// @nodoc
class __$$RealtimeEventSessionUpdateImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventSessionUpdateImpl>
    implements _$$RealtimeEventSessionUpdateImplCopyWith<$Res> {
  __$$RealtimeEventSessionUpdateImplCopyWithImpl(
      _$RealtimeEventSessionUpdateImpl _value,
      $Res Function(_$RealtimeEventSessionUpdateImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = freezed,
    Object? type = null,
    Object? session = null,
  }) {
    return _then(_$RealtimeEventSessionUpdateImpl(
      eventId: freezed == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String?,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      session: null == session
          ? _value.session
          : session // ignore: cast_nullable_to_non_nullable
              as SessionConfig,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $SessionConfigCopyWith<$Res> get session {
    return $SessionConfigCopyWith<$Res>(_value.session, (value) {
      return _then(_value.copyWith(session: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventSessionUpdateImpl extends RealtimeEventSessionUpdate {
  const _$RealtimeEventSessionUpdateImpl(
      {@JsonKey(name: 'event_id', includeIfNull: false) this.eventId,
      this.type = RealtimeEventType.sessionUpdate,
      required this.session})
      : super._();

  factory _$RealtimeEventSessionUpdateImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventSessionUpdateImplFromJson(json);

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id', includeIfNull: false)
  final String? eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// Session configuration to update.
  @override
  final SessionConfig session;

  @override
  String toString() {
    return 'RealtimeEvent.sessionUpdate(eventId: $eventId, type: $type, session: $session)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventSessionUpdateImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.session, session) || other.session == session));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, session);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventSessionUpdateImplCopyWith<_$RealtimeEventSessionUpdateImpl>
      get copyWith => __$$RealtimeEventSessionUpdateImplCopyWithImpl<
          _$RealtimeEventSessionUpdateImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return sessionUpdate(eventId, type, session);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return sessionUpdate?.call(eventId, type, session);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (sessionUpdate != null) {
      return sessionUpdate(eventId, type, session);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return sessionUpdate(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return sessionUpdate?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (sessionUpdate != null) {
      return sessionUpdate(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventSessionUpdateImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventSessionUpdate extends RealtimeEvent {
  const factory RealtimeEventSessionUpdate(
      {@JsonKey(name: 'event_id', includeIfNull: false) final String? eventId,
      final RealtimeEventType type,
      required final SessionConfig session}) = _$RealtimeEventSessionUpdateImpl;
  const RealtimeEventSessionUpdate._() : super._();

  factory RealtimeEventSessionUpdate.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventSessionUpdateImpl.fromJson;

  /// Optional client-generated ID used to identify this event.
  @override
  @JsonKey(name: 'event_id', includeIfNull: false)
  String? get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// Session configuration to update.
  SessionConfig get session;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventSessionUpdateImplCopyWith<_$RealtimeEventSessionUpdateImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventConversationCreatedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventConversationCreatedImplCopyWith(
          _$RealtimeEventConversationCreatedImpl value,
          $Res Function(_$RealtimeEventConversationCreatedImpl) then) =
      __$$RealtimeEventConversationCreatedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      Conversation conversation});

  $ConversationCopyWith<$Res> get conversation;
}

/// @nodoc
class __$$RealtimeEventConversationCreatedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventConversationCreatedImpl>
    implements _$$RealtimeEventConversationCreatedImplCopyWith<$Res> {
  __$$RealtimeEventConversationCreatedImplCopyWithImpl(
      _$RealtimeEventConversationCreatedImpl _value,
      $Res Function(_$RealtimeEventConversationCreatedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? conversation = null,
  }) {
    return _then(_$RealtimeEventConversationCreatedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      conversation: null == conversation
          ? _value.conversation
          : conversation // ignore: cast_nullable_to_non_nullable
              as Conversation,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ConversationCopyWith<$Res> get conversation {
    return $ConversationCopyWith<$Res>(_value.conversation, (value) {
      return _then(_value.copyWith(conversation: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventConversationCreatedImpl
    extends RealtimeEventConversationCreated {
  const _$RealtimeEventConversationCreatedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.conversationCreated,
      required this.conversation})
      : super._();

  factory _$RealtimeEventConversationCreatedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventConversationCreatedImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The conversation resource.
  @override
  final Conversation conversation;

  @override
  String toString() {
    return 'RealtimeEvent.conversationCreated(eventId: $eventId, type: $type, conversation: $conversation)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventConversationCreatedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.conversation, conversation) ||
                other.conversation == conversation));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, conversation);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventConversationCreatedImplCopyWith<
          _$RealtimeEventConversationCreatedImpl>
      get copyWith => __$$RealtimeEventConversationCreatedImplCopyWithImpl<
          _$RealtimeEventConversationCreatedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return conversationCreated(eventId, type, conversation);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return conversationCreated?.call(eventId, type, conversation);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (conversationCreated != null) {
      return conversationCreated(eventId, type, conversation);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return conversationCreated(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return conversationCreated?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (conversationCreated != null) {
      return conversationCreated(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventConversationCreatedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventConversationCreated extends RealtimeEvent {
  const factory RealtimeEventConversationCreated(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          required final Conversation conversation}) =
      _$RealtimeEventConversationCreatedImpl;
  const RealtimeEventConversationCreated._() : super._();

  factory RealtimeEventConversationCreated.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventConversationCreatedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The conversation resource.
  Conversation get conversation;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventConversationCreatedImplCopyWith<
          _$RealtimeEventConversationCreatedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventConversationItemCreatedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventConversationItemCreatedImplCopyWith(
          _$RealtimeEventConversationItemCreatedImpl value,
          $Res Function(_$RealtimeEventConversationItemCreatedImpl) then) =
      __$$RealtimeEventConversationItemCreatedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'previous_item_id') String? previousItemId,
      Item item});

  $ItemCopyWith<$Res> get item;
}

/// @nodoc
class __$$RealtimeEventConversationItemCreatedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventConversationItemCreatedImpl>
    implements _$$RealtimeEventConversationItemCreatedImplCopyWith<$Res> {
  __$$RealtimeEventConversationItemCreatedImplCopyWithImpl(
      _$RealtimeEventConversationItemCreatedImpl _value,
      $Res Function(_$RealtimeEventConversationItemCreatedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? previousItemId = freezed,
    Object? item = null,
  }) {
    return _then(_$RealtimeEventConversationItemCreatedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      previousItemId: freezed == previousItemId
          ? _value.previousItemId
          : previousItemId // ignore: cast_nullable_to_non_nullable
              as String?,
      item: null == item
          ? _value.item
          : item // ignore: cast_nullable_to_non_nullable
              as Item,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ItemCopyWith<$Res> get item {
    return $ItemCopyWith<$Res>(_value.item, (value) {
      return _then(_value.copyWith(item: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventConversationItemCreatedImpl
    extends RealtimeEventConversationItemCreated {
  const _$RealtimeEventConversationItemCreatedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.conversationItemCreated,
      @JsonKey(name: 'previous_item_id') required this.previousItemId,
      required this.item})
      : super._();

  factory _$RealtimeEventConversationItemCreatedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventConversationItemCreatedImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the preceding item in the Conversation context, allows the client to understand the
  /// order of the conversation.
  @override
  @JsonKey(name: 'previous_item_id')
  final String? previousItemId;

  /// The item to add to the conversation.
  /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput]
  @override
  final Item item;

  @override
  String toString() {
    return 'RealtimeEvent.conversationItemCreated(eventId: $eventId, type: $type, previousItemId: $previousItemId, item: $item)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventConversationItemCreatedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.previousItemId, previousItemId) ||
                other.previousItemId == previousItemId) &&
            (identical(other.item, item) || other.item == item));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, eventId, type, previousItemId, item);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventConversationItemCreatedImplCopyWith<
          _$RealtimeEventConversationItemCreatedImpl>
      get copyWith => __$$RealtimeEventConversationItemCreatedImplCopyWithImpl<
          _$RealtimeEventConversationItemCreatedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return conversationItemCreated(eventId, type, previousItemId, item);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return conversationItemCreated?.call(eventId, type, previousItemId, item);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (conversationItemCreated != null) {
      return conversationItemCreated(eventId, type, previousItemId, item);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return conversationItemCreated(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return conversationItemCreated?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (conversationItemCreated != null) {
      return conversationItemCreated(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventConversationItemCreatedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventConversationItemCreated extends RealtimeEvent {
  const factory RealtimeEventConversationItemCreated(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      @JsonKey(name: 'previous_item_id') required final String? previousItemId,
      required final Item item}) = _$RealtimeEventConversationItemCreatedImpl;
  const RealtimeEventConversationItemCreated._() : super._();

  factory RealtimeEventConversationItemCreated.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventConversationItemCreatedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the preceding item in the Conversation context, allows the client to understand the
  /// order of the conversation.
  @JsonKey(name: 'previous_item_id')
  String? get previousItemId;

  /// The item to add to the conversation.
  /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput]
  Item get item;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventConversationItemCreatedImplCopyWith<
          _$RealtimeEventConversationItemCreatedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventConversationItemDeletedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventConversationItemDeletedImplCopyWith(
          _$RealtimeEventConversationItemDeletedImpl value,
          $Res Function(_$RealtimeEventConversationItemDeletedImpl) then) =
      __$$RealtimeEventConversationItemDeletedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'item_id') String itemId});
}

/// @nodoc
class __$$RealtimeEventConversationItemDeletedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventConversationItemDeletedImpl>
    implements _$$RealtimeEventConversationItemDeletedImplCopyWith<$Res> {
  __$$RealtimeEventConversationItemDeletedImplCopyWithImpl(
      _$RealtimeEventConversationItemDeletedImpl _value,
      $Res Function(_$RealtimeEventConversationItemDeletedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? itemId = null,
  }) {
    return _then(_$RealtimeEventConversationItemDeletedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventConversationItemDeletedImpl
    extends RealtimeEventConversationItemDeleted {
  const _$RealtimeEventConversationItemDeletedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.conversationItemDeleted,
      @JsonKey(name: 'item_id') required this.itemId})
      : super._();

  factory _$RealtimeEventConversationItemDeletedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventConversationItemDeletedImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the item that was deleted.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  @override
  String toString() {
    return 'RealtimeEvent.conversationItemDeleted(eventId: $eventId, type: $type, itemId: $itemId)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventConversationItemDeletedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.itemId, itemId) || other.itemId == itemId));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, itemId);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventConversationItemDeletedImplCopyWith<
          _$RealtimeEventConversationItemDeletedImpl>
      get copyWith => __$$RealtimeEventConversationItemDeletedImplCopyWithImpl<
          _$RealtimeEventConversationItemDeletedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return conversationItemDeleted(eventId, type, itemId);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return conversationItemDeleted?.call(eventId, type, itemId);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (conversationItemDeleted != null) {
      return conversationItemDeleted(eventId, type, itemId);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return conversationItemDeleted(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return conversationItemDeleted?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (conversationItemDeleted != null) {
      return conversationItemDeleted(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventConversationItemDeletedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventConversationItemDeleted extends RealtimeEvent {
  const factory RealtimeEventConversationItemDeleted(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'item_id') required final String itemId}) =
      _$RealtimeEventConversationItemDeletedImpl;
  const RealtimeEventConversationItemDeleted._() : super._();

  factory RealtimeEventConversationItemDeleted.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventConversationItemDeletedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the item that was deleted.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventConversationItemDeletedImplCopyWith<
          _$RealtimeEventConversationItemDeletedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWith<
    $Res> implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWith(
          _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl value,
          $Res Function(
                  _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl)
              then) =
      __$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWithImpl<
          $Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'item_id') String itemId,
      @JsonKey(name: 'content_index') int contentIndex,
      String transcript});
}

/// @nodoc
class __$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWithImpl<
        $Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl>
    implements
        _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWith<
            $Res> {
  __$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWithImpl(
      _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl
          _value,
      $Res Function(
              _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl)
          _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? itemId = null,
    Object? contentIndex = null,
    Object? transcript = null,
  }) {
    return _then(
        _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
      contentIndex: null == contentIndex
          ? _value.contentIndex
          : contentIndex // ignore: cast_nullable_to_non_nullable
              as int,
      transcript: null == transcript
          ? _value.transcript
          : transcript // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl
    extends RealtimeEventConversationItemInputAudioTranscriptionCompleted {
  const _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type =
          RealtimeEventType.conversationItemInputAudioTranscriptionCompleted,
      @JsonKey(name: 'item_id') required this.itemId,
      @JsonKey(name: 'content_index') required this.contentIndex,
      required this.transcript})
      : super._();

  factory _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplFromJson(
          json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the user message item containing the audio.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  /// The index of the content part containing the audio.
  @override
  @JsonKey(name: 'content_index')
  final int contentIndex;

  /// The transcribed text.
  @override
  final String transcript;

  @override
  String toString() {
    return 'RealtimeEvent.conversationItemInputAudioTranscriptionCompleted(eventId: $eventId, type: $type, itemId: $itemId, contentIndex: $contentIndex, transcript: $transcript)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other
                is _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.itemId, itemId) || other.itemId == itemId) &&
            (identical(other.contentIndex, contentIndex) ||
                other.contentIndex == contentIndex) &&
            (identical(other.transcript, transcript) ||
                other.transcript == transcript));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, eventId, type, itemId, contentIndex, transcript);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWith<
          _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl>
      get copyWith =>
          __$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWithImpl<
                  _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl>(
              this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return conversationItemInputAudioTranscriptionCompleted(
        eventId, type, itemId, contentIndex, transcript);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return conversationItemInputAudioTranscriptionCompleted?.call(
        eventId, type, itemId, contentIndex, transcript);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (conversationItemInputAudioTranscriptionCompleted != null) {
      return conversationItemInputAudioTranscriptionCompleted(
          eventId, type, itemId, contentIndex, transcript);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return conversationItemInputAudioTranscriptionCompleted(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return conversationItemInputAudioTranscriptionCompleted?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (conversationItemInputAudioTranscriptionCompleted != null) {
      return conversationItemInputAudioTranscriptionCompleted(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventConversationItemInputAudioTranscriptionCompleted
    extends RealtimeEvent {
  const factory RealtimeEventConversationItemInputAudioTranscriptionCompleted(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'item_id') required final String itemId,
          @JsonKey(name: 'content_index') required final int contentIndex,
          required final String transcript}) =
      _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl;
  const RealtimeEventConversationItemInputAudioTranscriptionCompleted._()
      : super._();

  factory RealtimeEventConversationItemInputAudioTranscriptionCompleted.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl
      .fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the user message item containing the audio.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// The index of the content part containing the audio.
  @JsonKey(name: 'content_index')
  int get contentIndex;

  /// The transcribed text.
  String get transcript;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWith<
          _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWith<
    $Res> implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWith(
          _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl value,
          $Res Function(
                  _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl)
              then) =
      __$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWithImpl<
          $Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'item_id') String itemId,
      @JsonKey(name: 'content_index') int contentIndex,
      TranscriptionError error});

  $TranscriptionErrorCopyWith<$Res> get error;
}

/// @nodoc
class __$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWithImpl<
        $Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl>
    implements
        _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWith<
            $Res> {
  __$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWithImpl(
      _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl _value,
      $Res Function(
              _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl)
          _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? itemId = null,
    Object? contentIndex = null,
    Object? error = null,
  }) {
    return _then(
        _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
      contentIndex: null == contentIndex
          ? _value.contentIndex
          : contentIndex // ignore: cast_nullable_to_non_nullable
              as int,
      error: null == error
          ? _value.error
          : error // ignore: cast_nullable_to_non_nullable
              as TranscriptionError,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $TranscriptionErrorCopyWith<$Res> get error {
    return $TranscriptionErrorCopyWith<$Res>(_value.error, (value) {
      return _then(_value.copyWith(error: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl
    extends RealtimeEventConversationItemInputAudioTranscriptionFailed {
  const _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type =
          RealtimeEventType.conversationItemInputAudioTranscriptionFailed,
      @JsonKey(name: 'item_id') required this.itemId,
      @JsonKey(name: 'content_index') required this.contentIndex,
      required this.error})
      : super._();

  factory _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplFromJson(
          json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the user message item.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  /// The index of the content part containing the audio.
  @override
  @JsonKey(name: 'content_index')
  final int contentIndex;

  /// Details of the transcription error.
  @override
  final TranscriptionError error;

  @override
  String toString() {
    return 'RealtimeEvent.conversationItemInputAudioTranscriptionFailed(eventId: $eventId, type: $type, itemId: $itemId, contentIndex: $contentIndex, error: $error)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other
                is _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.itemId, itemId) || other.itemId == itemId) &&
            (identical(other.contentIndex, contentIndex) ||
                other.contentIndex == contentIndex) &&
            (identical(other.error, error) || other.error == error));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, eventId, type, itemId, contentIndex, error);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWith<
          _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl>
      get copyWith =>
          __$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWithImpl<
                  _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl>(
              this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return conversationItemInputAudioTranscriptionFailed(
        eventId, type, itemId, contentIndex, this.error);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return conversationItemInputAudioTranscriptionFailed?.call(
        eventId, type, itemId, contentIndex, this.error);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (conversationItemInputAudioTranscriptionFailed != null) {
      return conversationItemInputAudioTranscriptionFailed(
          eventId, type, itemId, contentIndex, this.error);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return conversationItemInputAudioTranscriptionFailed(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return conversationItemInputAudioTranscriptionFailed?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (conversationItemInputAudioTranscriptionFailed != null) {
      return conversationItemInputAudioTranscriptionFailed(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventConversationItemInputAudioTranscriptionFailed
    extends RealtimeEvent {
  const factory RealtimeEventConversationItemInputAudioTranscriptionFailed(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'item_id') required final String itemId,
          @JsonKey(name: 'content_index') required final int contentIndex,
          required final TranscriptionError error}) =
      _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl;
  const RealtimeEventConversationItemInputAudioTranscriptionFailed._()
      : super._();

  factory RealtimeEventConversationItemInputAudioTranscriptionFailed.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the user message item.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// The index of the content part containing the audio.
  @JsonKey(name: 'content_index')
  int get contentIndex;

  /// Details of the transcription error.
  TranscriptionError get error;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWith<
          _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventConversationItemTruncatedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventConversationItemTruncatedImplCopyWith(
          _$RealtimeEventConversationItemTruncatedImpl value,
          $Res Function(_$RealtimeEventConversationItemTruncatedImpl) then) =
      __$$RealtimeEventConversationItemTruncatedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'item_id') String itemId,
      @JsonKey(name: 'content_index') int contentIndex,
      @JsonKey(name: 'audio_end_ms') int audioEndMs});
}

/// @nodoc
class __$$RealtimeEventConversationItemTruncatedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventConversationItemTruncatedImpl>
    implements _$$RealtimeEventConversationItemTruncatedImplCopyWith<$Res> {
  __$$RealtimeEventConversationItemTruncatedImplCopyWithImpl(
      _$RealtimeEventConversationItemTruncatedImpl _value,
      $Res Function(_$RealtimeEventConversationItemTruncatedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? itemId = null,
    Object? contentIndex = null,
    Object? audioEndMs = null,
  }) {
    return _then(_$RealtimeEventConversationItemTruncatedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
      contentIndex: null == contentIndex
          ? _value.contentIndex
          : contentIndex // ignore: cast_nullable_to_non_nullable
              as int,
      audioEndMs: null == audioEndMs
          ? _value.audioEndMs
          : audioEndMs // ignore: cast_nullable_to_non_nullable
              as int,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventConversationItemTruncatedImpl
    extends RealtimeEventConversationItemTruncated {
  const _$RealtimeEventConversationItemTruncatedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.conversationItemTruncated,
      @JsonKey(name: 'item_id') required this.itemId,
      @JsonKey(name: 'content_index') required this.contentIndex,
      @JsonKey(name: 'audio_end_ms') required this.audioEndMs})
      : super._();

  factory _$RealtimeEventConversationItemTruncatedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventConversationItemTruncatedImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the assistant message item that was truncated.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  /// The index of the content part that was truncated.
  @override
  @JsonKey(name: 'content_index')
  final int contentIndex;

  /// The duration up to which the audio was truncated, in milliseconds.
  @override
  @JsonKey(name: 'audio_end_ms')
  final int audioEndMs;

  @override
  String toString() {
    return 'RealtimeEvent.conversationItemTruncated(eventId: $eventId, type: $type, itemId: $itemId, contentIndex: $contentIndex, audioEndMs: $audioEndMs)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventConversationItemTruncatedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.itemId, itemId) || other.itemId == itemId) &&
            (identical(other.contentIndex, contentIndex) ||
                other.contentIndex == contentIndex) &&
            (identical(other.audioEndMs, audioEndMs) ||
                other.audioEndMs == audioEndMs));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, eventId, type, itemId, contentIndex, audioEndMs);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventConversationItemTruncatedImplCopyWith<
          _$RealtimeEventConversationItemTruncatedImpl>
      get copyWith =>
          __$$RealtimeEventConversationItemTruncatedImplCopyWithImpl<
              _$RealtimeEventConversationItemTruncatedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return conversationItemTruncated(
        eventId, type, itemId, contentIndex, audioEndMs);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return conversationItemTruncated?.call(
        eventId, type, itemId, contentIndex, audioEndMs);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (conversationItemTruncated != null) {
      return conversationItemTruncated(
          eventId, type, itemId, contentIndex, audioEndMs);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return conversationItemTruncated(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return conversationItemTruncated?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (conversationItemTruncated != null) {
      return conversationItemTruncated(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventConversationItemTruncatedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventConversationItemTruncated extends RealtimeEvent {
  const factory RealtimeEventConversationItemTruncated(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'item_id') required final String itemId,
          @JsonKey(name: 'content_index') required final int contentIndex,
          @JsonKey(name: 'audio_end_ms') required final int audioEndMs}) =
      _$RealtimeEventConversationItemTruncatedImpl;
  const RealtimeEventConversationItemTruncated._() : super._();

  factory RealtimeEventConversationItemTruncated.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventConversationItemTruncatedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the assistant message item that was truncated.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// The index of the content part that was truncated.
  @JsonKey(name: 'content_index')
  int get contentIndex;

  /// The duration up to which the audio was truncated, in milliseconds.
  @JsonKey(name: 'audio_end_ms')
  int get audioEndMs;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventConversationItemTruncatedImplCopyWith<
          _$RealtimeEventConversationItemTruncatedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventErrorImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventErrorImplCopyWith(_$RealtimeEventErrorImpl value,
          $Res Function(_$RealtimeEventErrorImpl) then) =
      __$$RealtimeEventErrorImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      APIError error});

  $APIErrorCopyWith<$Res> get error;
}

/// @nodoc
class __$$RealtimeEventErrorImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventErrorImpl>
    implements _$$RealtimeEventErrorImplCopyWith<$Res> {
  __$$RealtimeEventErrorImplCopyWithImpl(_$RealtimeEventErrorImpl _value,
      $Res Function(_$RealtimeEventErrorImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? error = null,
  }) {
    return _then(_$RealtimeEventErrorImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      error: null == error
          ? _value.error
          : error // ignore: cast_nullable_to_non_nullable
              as APIError,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $APIErrorCopyWith<$Res> get error {
    return $APIErrorCopyWith<$Res>(_value.error, (value) {
      return _then(_value.copyWith(error: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventErrorImpl extends RealtimeEventError {
  const _$RealtimeEventErrorImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.error,
      required this.error})
      : super._();

  factory _$RealtimeEventErrorImpl.fromJson(Map<String, dynamic> json) =>
      _$$RealtimeEventErrorImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// Details of the API error.
  @override
  final APIError error;

  @override
  String toString() {
    return 'RealtimeEvent.error(eventId: $eventId, type: $type, error: $error)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventErrorImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.error, error) || other.error == error));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, error);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventErrorImplCopyWith<_$RealtimeEventErrorImpl> get copyWith =>
      __$$RealtimeEventErrorImplCopyWithImpl<_$RealtimeEventErrorImpl>(
          this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return error(eventId, type, this.error);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return error?.call(eventId, type, this.error);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (error != null) {
      return error(eventId, type, this.error);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return error(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return error?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (error != null) {
      return error(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventErrorImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventError extends RealtimeEvent {
  const factory RealtimeEventError(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      required final APIError error}) = _$RealtimeEventErrorImpl;
  const RealtimeEventError._() : super._();

  factory RealtimeEventError.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventErrorImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// Details of the API error.
  APIError get error;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventErrorImplCopyWith<_$RealtimeEventErrorImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventInputAudioBufferClearedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventInputAudioBufferClearedImplCopyWith(
          _$RealtimeEventInputAudioBufferClearedImpl value,
          $Res Function(_$RealtimeEventInputAudioBufferClearedImpl) then) =
      __$$RealtimeEventInputAudioBufferClearedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId, RealtimeEventType type});
}

/// @nodoc
class __$$RealtimeEventInputAudioBufferClearedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventInputAudioBufferClearedImpl>
    implements _$$RealtimeEventInputAudioBufferClearedImplCopyWith<$Res> {
  __$$RealtimeEventInputAudioBufferClearedImplCopyWithImpl(
      _$RealtimeEventInputAudioBufferClearedImpl _value,
      $Res Function(_$RealtimeEventInputAudioBufferClearedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
  }) {
    return _then(_$RealtimeEventInputAudioBufferClearedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventInputAudioBufferClearedImpl
    extends RealtimeEventInputAudioBufferCleared {
  const _$RealtimeEventInputAudioBufferClearedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.inputAudioBufferCleared})
      : super._();

  factory _$RealtimeEventInputAudioBufferClearedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventInputAudioBufferClearedImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  @override
  String toString() {
    return 'RealtimeEvent.inputAudioBufferCleared(eventId: $eventId, type: $type)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventInputAudioBufferClearedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventInputAudioBufferClearedImplCopyWith<
          _$RealtimeEventInputAudioBufferClearedImpl>
      get copyWith => __$$RealtimeEventInputAudioBufferClearedImplCopyWithImpl<
          _$RealtimeEventInputAudioBufferClearedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return inputAudioBufferCleared(eventId, type);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return inputAudioBufferCleared?.call(eventId, type);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (inputAudioBufferCleared != null) {
      return inputAudioBufferCleared(eventId, type);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return inputAudioBufferCleared(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return inputAudioBufferCleared?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (inputAudioBufferCleared != null) {
      return inputAudioBufferCleared(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventInputAudioBufferClearedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventInputAudioBufferCleared extends RealtimeEvent {
  const factory RealtimeEventInputAudioBufferCleared(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type}) =
      _$RealtimeEventInputAudioBufferClearedImpl;
  const RealtimeEventInputAudioBufferCleared._() : super._();

  factory RealtimeEventInputAudioBufferCleared.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventInputAudioBufferClearedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventInputAudioBufferClearedImplCopyWith<
          _$RealtimeEventInputAudioBufferClearedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventInputAudioBufferCommittedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventInputAudioBufferCommittedImplCopyWith(
          _$RealtimeEventInputAudioBufferCommittedImpl value,
          $Res Function(_$RealtimeEventInputAudioBufferCommittedImpl) then) =
      __$$RealtimeEventInputAudioBufferCommittedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'previous_item_id') String previousItemId,
      @JsonKey(name: 'item_id') String itemId});
}

/// @nodoc
class __$$RealtimeEventInputAudioBufferCommittedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventInputAudioBufferCommittedImpl>
    implements _$$RealtimeEventInputAudioBufferCommittedImplCopyWith<$Res> {
  __$$RealtimeEventInputAudioBufferCommittedImplCopyWithImpl(
      _$RealtimeEventInputAudioBufferCommittedImpl _value,
      $Res Function(_$RealtimeEventInputAudioBufferCommittedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? previousItemId = null,
    Object? itemId = null,
  }) {
    return _then(_$RealtimeEventInputAudioBufferCommittedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      previousItemId: null == previousItemId
          ? _value.previousItemId
          : previousItemId // ignore: cast_nullable_to_non_nullable
              as String,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventInputAudioBufferCommittedImpl
    extends RealtimeEventInputAudioBufferCommitted {
  const _$RealtimeEventInputAudioBufferCommittedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.inputAudioBufferCommitted,
      @JsonKey(name: 'previous_item_id') required this.previousItemId,
      @JsonKey(name: 'item_id') required this.itemId})
      : super._();

  factory _$RealtimeEventInputAudioBufferCommittedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventInputAudioBufferCommittedImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the preceding item after which the new item will be inserted.
  @override
  @JsonKey(name: 'previous_item_id')
  final String previousItemId;

  /// The ID of the user message item that will be created.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  @override
  String toString() {
    return 'RealtimeEvent.inputAudioBufferCommitted(eventId: $eventId, type: $type, previousItemId: $previousItemId, itemId: $itemId)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventInputAudioBufferCommittedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.previousItemId, previousItemId) ||
                other.previousItemId == previousItemId) &&
            (identical(other.itemId, itemId) || other.itemId == itemId));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, eventId, type, previousItemId, itemId);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventInputAudioBufferCommittedImplCopyWith<
          _$RealtimeEventInputAudioBufferCommittedImpl>
      get copyWith =>
          __$$RealtimeEventInputAudioBufferCommittedImplCopyWithImpl<
              _$RealtimeEventInputAudioBufferCommittedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return inputAudioBufferCommitted(eventId, type, previousItemId, itemId);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return inputAudioBufferCommitted?.call(
        eventId, type, previousItemId, itemId);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (inputAudioBufferCommitted != null) {
      return inputAudioBufferCommitted(eventId, type, previousItemId, itemId);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return inputAudioBufferCommitted(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return inputAudioBufferCommitted?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (inputAudioBufferCommitted != null) {
      return inputAudioBufferCommitted(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventInputAudioBufferCommittedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventInputAudioBufferCommitted extends RealtimeEvent {
  const factory RealtimeEventInputAudioBufferCommitted(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      @JsonKey(name: 'previous_item_id') required final String previousItemId,
      @JsonKey(name: 'item_id')
      required final String
          itemId}) = _$RealtimeEventInputAudioBufferCommittedImpl;
  const RealtimeEventInputAudioBufferCommitted._() : super._();

  factory RealtimeEventInputAudioBufferCommitted.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventInputAudioBufferCommittedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the preceding item after which the new item will be inserted.
  @JsonKey(name: 'previous_item_id')
  String get previousItemId;

  /// The ID of the user message item that will be created.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventInputAudioBufferCommittedImplCopyWith<
          _$RealtimeEventInputAudioBufferCommittedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWith(
          _$RealtimeEventInputAudioBufferSpeechStartedImpl value,
          $Res Function(_$RealtimeEventInputAudioBufferSpeechStartedImpl)
              then) =
      __$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'audio_start_ms') int audioStartMs,
      @JsonKey(name: 'item_id') String itemId});
}

/// @nodoc
class __$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventInputAudioBufferSpeechStartedImpl>
    implements _$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWith<$Res> {
  __$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWithImpl(
      _$RealtimeEventInputAudioBufferSpeechStartedImpl _value,
      $Res Function(_$RealtimeEventInputAudioBufferSpeechStartedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? audioStartMs = null,
    Object? itemId = null,
  }) {
    return _then(_$RealtimeEventInputAudioBufferSpeechStartedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      audioStartMs: null == audioStartMs
          ? _value.audioStartMs
          : audioStartMs // ignore: cast_nullable_to_non_nullable
              as int,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventInputAudioBufferSpeechStartedImpl
    extends RealtimeEventInputAudioBufferSpeechStarted {
  const _$RealtimeEventInputAudioBufferSpeechStartedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.inputAudioBufferSpeechStarted,
      @JsonKey(name: 'audio_start_ms') required this.audioStartMs,
      @JsonKey(name: 'item_id') required this.itemId})
      : super._();

  factory _$RealtimeEventInputAudioBufferSpeechStartedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventInputAudioBufferSpeechStartedImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// Milliseconds from the start of all audio written to the buffer during the session when speech was
  /// first detected. This will correspond to the beginning of audio sent to the model, and thus
  /// includes the `prefix_padding_ms` configured in the Session.
  @override
  @JsonKey(name: 'audio_start_ms')
  final int audioStartMs;

  /// The ID of the user message item that will be created when speech stops.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  @override
  String toString() {
    return 'RealtimeEvent.inputAudioBufferSpeechStarted(eventId: $eventId, type: $type, audioStartMs: $audioStartMs, itemId: $itemId)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventInputAudioBufferSpeechStartedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.audioStartMs, audioStartMs) ||
                other.audioStartMs == audioStartMs) &&
            (identical(other.itemId, itemId) || other.itemId == itemId));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, eventId, type, audioStartMs, itemId);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWith<
          _$RealtimeEventInputAudioBufferSpeechStartedImpl>
      get copyWith =>
          __$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWithImpl<
                  _$RealtimeEventInputAudioBufferSpeechStartedImpl>(
              this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return inputAudioBufferSpeechStarted(eventId, type, audioStartMs, itemId);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return inputAudioBufferSpeechStarted?.call(
        eventId, type, audioStartMs, itemId);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (inputAudioBufferSpeechStarted != null) {
      return inputAudioBufferSpeechStarted(eventId, type, audioStartMs, itemId);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return inputAudioBufferSpeechStarted(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return inputAudioBufferSpeechStarted?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (inputAudioBufferSpeechStarted != null) {
      return inputAudioBufferSpeechStarted(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventInputAudioBufferSpeechStartedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventInputAudioBufferSpeechStarted
    extends RealtimeEvent {
  const factory RealtimeEventInputAudioBufferSpeechStarted(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'audio_start_ms') required final int audioStartMs,
          @JsonKey(name: 'item_id') required final String itemId}) =
      _$RealtimeEventInputAudioBufferSpeechStartedImpl;
  const RealtimeEventInputAudioBufferSpeechStarted._() : super._();

  factory RealtimeEventInputAudioBufferSpeechStarted.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventInputAudioBufferSpeechStartedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// Milliseconds from the start of all audio written to the buffer during the session when speech was
  /// first detected. This will correspond to the beginning of audio sent to the model, and thus
  /// includes the `prefix_padding_ms` configured in the Session.
  @JsonKey(name: 'audio_start_ms')
  int get audioStartMs;

  /// The ID of the user message item that will be created when speech stops.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWith<
          _$RealtimeEventInputAudioBufferSpeechStartedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWith(
          _$RealtimeEventInputAudioBufferSpeechStoppedImpl value,
          $Res Function(_$RealtimeEventInputAudioBufferSpeechStoppedImpl)
              then) =
      __$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'audio_end_ms') int audioEndMs,
      @JsonKey(name: 'item_id') String itemId});
}

/// @nodoc
class __$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventInputAudioBufferSpeechStoppedImpl>
    implements _$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWith<$Res> {
  __$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWithImpl(
      _$RealtimeEventInputAudioBufferSpeechStoppedImpl _value,
      $Res Function(_$RealtimeEventInputAudioBufferSpeechStoppedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? audioEndMs = null,
    Object? itemId = null,
  }) {
    return _then(_$RealtimeEventInputAudioBufferSpeechStoppedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      audioEndMs: null == audioEndMs
          ? _value.audioEndMs
          : audioEndMs // ignore: cast_nullable_to_non_nullable
              as int,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventInputAudioBufferSpeechStoppedImpl
    extends RealtimeEventInputAudioBufferSpeechStopped {
  const _$RealtimeEventInputAudioBufferSpeechStoppedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.inputAudioBufferSpeechStopped,
      @JsonKey(name: 'audio_end_ms') required this.audioEndMs,
      @JsonKey(name: 'item_id') required this.itemId})
      : super._();

  factory _$RealtimeEventInputAudioBufferSpeechStoppedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventInputAudioBufferSpeechStoppedImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// Milliseconds since the session started when speech stopped. This will correspond to the end of
  /// audio sent to the model, and thus includes the `min_silence_duration_ms` configured in the
  /// Session.
  @override
  @JsonKey(name: 'audio_end_ms')
  final int audioEndMs;

  /// The ID of the user message item that will be created.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  @override
  String toString() {
    return 'RealtimeEvent.inputAudioBufferSpeechStopped(eventId: $eventId, type: $type, audioEndMs: $audioEndMs, itemId: $itemId)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventInputAudioBufferSpeechStoppedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.audioEndMs, audioEndMs) ||
                other.audioEndMs == audioEndMs) &&
            (identical(other.itemId, itemId) || other.itemId == itemId));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, eventId, type, audioEndMs, itemId);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWith<
          _$RealtimeEventInputAudioBufferSpeechStoppedImpl>
      get copyWith =>
          __$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWithImpl<
                  _$RealtimeEventInputAudioBufferSpeechStoppedImpl>(
              this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return inputAudioBufferSpeechStopped(eventId, type, audioEndMs, itemId);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return inputAudioBufferSpeechStopped?.call(
        eventId, type, audioEndMs, itemId);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (inputAudioBufferSpeechStopped != null) {
      return inputAudioBufferSpeechStopped(eventId, type, audioEndMs, itemId);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return inputAudioBufferSpeechStopped(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return inputAudioBufferSpeechStopped?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (inputAudioBufferSpeechStopped != null) {
      return inputAudioBufferSpeechStopped(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventInputAudioBufferSpeechStoppedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventInputAudioBufferSpeechStopped
    extends RealtimeEvent {
  const factory RealtimeEventInputAudioBufferSpeechStopped(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'audio_end_ms') required final int audioEndMs,
          @JsonKey(name: 'item_id') required final String itemId}) =
      _$RealtimeEventInputAudioBufferSpeechStoppedImpl;
  const RealtimeEventInputAudioBufferSpeechStopped._() : super._();

  factory RealtimeEventInputAudioBufferSpeechStopped.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventInputAudioBufferSpeechStoppedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// Milliseconds since the session started when speech stopped. This will correspond to the end of
  /// audio sent to the model, and thus includes the `min_silence_duration_ms` configured in the
  /// Session.
  @JsonKey(name: 'audio_end_ms')
  int get audioEndMs;

  /// The ID of the user message item that will be created.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWith<
          _$RealtimeEventInputAudioBufferSpeechStoppedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventRateLimitsUpdatedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventRateLimitsUpdatedImplCopyWith(
          _$RealtimeEventRateLimitsUpdatedImpl value,
          $Res Function(_$RealtimeEventRateLimitsUpdatedImpl) then) =
      __$$RealtimeEventRateLimitsUpdatedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits});
}

/// @nodoc
class __$$RealtimeEventRateLimitsUpdatedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventRateLimitsUpdatedImpl>
    implements _$$RealtimeEventRateLimitsUpdatedImplCopyWith<$Res> {
  __$$RealtimeEventRateLimitsUpdatedImplCopyWithImpl(
      _$RealtimeEventRateLimitsUpdatedImpl _value,
      $Res Function(_$RealtimeEventRateLimitsUpdatedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? rateLimits = null,
  }) {
    return _then(_$RealtimeEventRateLimitsUpdatedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      rateLimits: null == rateLimits
          ? _value._rateLimits
          : rateLimits // ignore: cast_nullable_to_non_nullable
              as List<RateLimit>,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventRateLimitsUpdatedImpl
    extends RealtimeEventRateLimitsUpdated {
  const _$RealtimeEventRateLimitsUpdatedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.rateLimitsUpdated,
      @JsonKey(name: 'rate_limits') required final List<RateLimit> rateLimits})
      : _rateLimits = rateLimits,
        super._();

  factory _$RealtimeEventRateLimitsUpdatedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventRateLimitsUpdatedImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// List of rate limit information.
  final List<RateLimit> _rateLimits;

  /// List of rate limit information.
  @override
  @JsonKey(name: 'rate_limits')
  List<RateLimit> get rateLimits {
    if (_rateLimits is EqualUnmodifiableListView) return _rateLimits;
    // ignore: implicit_dynamic_type
    return EqualUnmodifiableListView(_rateLimits);
  }

  @override
  String toString() {
    return 'RealtimeEvent.rateLimitsUpdated(eventId: $eventId, type: $type, rateLimits: $rateLimits)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventRateLimitsUpdatedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            const DeepCollectionEquality()
                .equals(other._rateLimits, _rateLimits));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type,
      const DeepCollectionEquality().hash(_rateLimits));

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventRateLimitsUpdatedImplCopyWith<
          _$RealtimeEventRateLimitsUpdatedImpl>
      get copyWith => __$$RealtimeEventRateLimitsUpdatedImplCopyWithImpl<
          _$RealtimeEventRateLimitsUpdatedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return rateLimitsUpdated(eventId, type, rateLimits);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return rateLimitsUpdated?.call(eventId, type, rateLimits);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (rateLimitsUpdated != null) {
      return rateLimitsUpdated(eventId, type, rateLimits);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return rateLimitsUpdated(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return rateLimitsUpdated?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (rateLimitsUpdated != null) {
      return rateLimitsUpdated(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventRateLimitsUpdatedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventRateLimitsUpdated extends RealtimeEvent {
  const factory RealtimeEventRateLimitsUpdated(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'rate_limits')
          required final List<RateLimit> rateLimits}) =
      _$RealtimeEventRateLimitsUpdatedImpl;
  const RealtimeEventRateLimitsUpdated._() : super._();

  factory RealtimeEventRateLimitsUpdated.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventRateLimitsUpdatedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// List of rate limit information.
  @JsonKey(name: 'rate_limits')
  List<RateLimit> get rateLimits;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventRateLimitsUpdatedImplCopyWith<
          _$RealtimeEventRateLimitsUpdatedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseAudioDeltaImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseAudioDeltaImplCopyWith(
          _$RealtimeEventResponseAudioDeltaImpl value,
          $Res Function(_$RealtimeEventResponseAudioDeltaImpl) then) =
      __$$RealtimeEventResponseAudioDeltaImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'response_id') String responseId,
      @JsonKey(name: 'item_id') String itemId,
      @JsonKey(name: 'output_index') int outputIndex,
      @JsonKey(name: 'content_index') int contentIndex,
      String delta});
}

/// @nodoc
class __$$RealtimeEventResponseAudioDeltaImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventResponseAudioDeltaImpl>
    implements _$$RealtimeEventResponseAudioDeltaImplCopyWith<$Res> {
  __$$RealtimeEventResponseAudioDeltaImplCopyWithImpl(
      _$RealtimeEventResponseAudioDeltaImpl _value,
      $Res Function(_$RealtimeEventResponseAudioDeltaImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? responseId = null,
    Object? itemId = null,
    Object? outputIndex = null,
    Object? contentIndex = null,
    Object? delta = null,
  }) {
    return _then(_$RealtimeEventResponseAudioDeltaImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      responseId: null == responseId
          ? _value.responseId
          : responseId // ignore: cast_nullable_to_non_nullable
              as String,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
      outputIndex: null == outputIndex
          ? _value.outputIndex
          : outputIndex // ignore: cast_nullable_to_non_nullable
              as int,
      contentIndex: null == contentIndex
          ? _value.contentIndex
          : contentIndex // ignore: cast_nullable_to_non_nullable
              as int,
      delta: null == delta
          ? _value.delta
          : delta // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseAudioDeltaImpl
    extends RealtimeEventResponseAudioDelta {
  const _$RealtimeEventResponseAudioDeltaImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseAudioDelta,
      @JsonKey(name: 'response_id') required this.responseId,
      @JsonKey(name: 'item_id') required this.itemId,
      @JsonKey(name: 'output_index') required this.outputIndex,
      @JsonKey(name: 'content_index') required this.contentIndex,
      required this.delta})
      : super._();

  factory _$RealtimeEventResponseAudioDeltaImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseAudioDeltaImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the response.
  @override
  @JsonKey(name: 'response_id')
  final String responseId;

  /// The ID of the item.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  /// The index of the output item in the response.
  @override
  @JsonKey(name: 'output_index')
  final int outputIndex;

  /// The index of the content part in the item's content array.
  @override
  @JsonKey(name: 'content_index')
  final int contentIndex;

  /// Base64-encoded audio data delta.
  @override
  final String delta;

  @override
  String toString() {
    return 'RealtimeEvent.responseAudioDelta(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex, delta: $delta)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseAudioDeltaImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.responseId, responseId) ||
                other.responseId == responseId) &&
            (identical(other.itemId, itemId) || other.itemId == itemId) &&
            (identical(other.outputIndex, outputIndex) ||
                other.outputIndex == outputIndex) &&
            (identical(other.contentIndex, contentIndex) ||
                other.contentIndex == contentIndex) &&
            (identical(other.delta, delta) || other.delta == delta));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, responseId,
      itemId, outputIndex, contentIndex, delta);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseAudioDeltaImplCopyWith<
          _$RealtimeEventResponseAudioDeltaImpl>
      get copyWith => __$$RealtimeEventResponseAudioDeltaImplCopyWithImpl<
          _$RealtimeEventResponseAudioDeltaImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseAudioDelta(
        eventId, type, responseId, itemId, outputIndex, contentIndex, delta);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseAudioDelta?.call(
        eventId, type, responseId, itemId, outputIndex, contentIndex, delta);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseAudioDelta != null) {
      return responseAudioDelta(
          eventId, type, responseId, itemId, outputIndex, contentIndex, delta);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseAudioDelta(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseAudioDelta?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseAudioDelta != null) {
      return responseAudioDelta(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseAudioDeltaImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseAudioDelta extends RealtimeEvent {
  const factory RealtimeEventResponseAudioDelta(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      @JsonKey(name: 'response_id') required final String responseId,
      @JsonKey(name: 'item_id') required final String itemId,
      @JsonKey(name: 'output_index') required final int outputIndex,
      @JsonKey(name: 'content_index') required final int contentIndex,
      required final String delta}) = _$RealtimeEventResponseAudioDeltaImpl;
  const RealtimeEventResponseAudioDelta._() : super._();

  factory RealtimeEventResponseAudioDelta.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventResponseAudioDeltaImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the response.
  @JsonKey(name: 'response_id')
  String get responseId;

  /// The ID of the item.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// The index of the output item in the response.
  @JsonKey(name: 'output_index')
  int get outputIndex;

  /// The index of the content part in the item's content array.
  @JsonKey(name: 'content_index')
  int get contentIndex;

  /// Base64-encoded audio data delta.
  String get delta;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseAudioDeltaImplCopyWith<
          _$RealtimeEventResponseAudioDeltaImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseAudioDoneImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseAudioDoneImplCopyWith(
          _$RealtimeEventResponseAudioDoneImpl value,
          $Res Function(_$RealtimeEventResponseAudioDoneImpl) then) =
      __$$RealtimeEventResponseAudioDoneImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'response_id') String responseId,
      @JsonKey(name: 'item_id') String itemId,
      @JsonKey(name: 'output_index') int outputIndex,
      @JsonKey(name: 'content_index') int contentIndex});
}

/// @nodoc
class __$$RealtimeEventResponseAudioDoneImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventResponseAudioDoneImpl>
    implements _$$RealtimeEventResponseAudioDoneImplCopyWith<$Res> {
  __$$RealtimeEventResponseAudioDoneImplCopyWithImpl(
      _$RealtimeEventResponseAudioDoneImpl _value,
      $Res Function(_$RealtimeEventResponseAudioDoneImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? responseId = null,
    Object? itemId = null,
    Object? outputIndex = null,
    Object? contentIndex = null,
  }) {
    return _then(_$RealtimeEventResponseAudioDoneImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      responseId: null == responseId
          ? _value.responseId
          : responseId // ignore: cast_nullable_to_non_nullable
              as String,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
      outputIndex: null == outputIndex
          ? _value.outputIndex
          : outputIndex // ignore: cast_nullable_to_non_nullable
              as int,
      contentIndex: null == contentIndex
          ? _value.contentIndex
          : contentIndex // ignore: cast_nullable_to_non_nullable
              as int,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseAudioDoneImpl
    extends RealtimeEventResponseAudioDone {
  const _$RealtimeEventResponseAudioDoneImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseAudioDone,
      @JsonKey(name: 'response_id') required this.responseId,
      @JsonKey(name: 'item_id') required this.itemId,
      @JsonKey(name: 'output_index') required this.outputIndex,
      @JsonKey(name: 'content_index') required this.contentIndex})
      : super._();

  factory _$RealtimeEventResponseAudioDoneImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseAudioDoneImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the response.
  @override
  @JsonKey(name: 'response_id')
  final String responseId;

  /// The ID of the item.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  /// The index of the output item in the response.
  @override
  @JsonKey(name: 'output_index')
  final int outputIndex;

  /// The index of the content part in the item's content array.
  @override
  @JsonKey(name: 'content_index')
  final int contentIndex;

  @override
  String toString() {
    return 'RealtimeEvent.responseAudioDone(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseAudioDoneImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.responseId, responseId) ||
                other.responseId == responseId) &&
            (identical(other.itemId, itemId) || other.itemId == itemId) &&
            (identical(other.outputIndex, outputIndex) ||
                other.outputIndex == outputIndex) &&
            (identical(other.contentIndex, contentIndex) ||
                other.contentIndex == contentIndex));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, responseId,
      itemId, outputIndex, contentIndex);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseAudioDoneImplCopyWith<
          _$RealtimeEventResponseAudioDoneImpl>
      get copyWith => __$$RealtimeEventResponseAudioDoneImplCopyWithImpl<
          _$RealtimeEventResponseAudioDoneImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseAudioDone(
        eventId, type, responseId, itemId, outputIndex, contentIndex);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseAudioDone?.call(
        eventId, type, responseId, itemId, outputIndex, contentIndex);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseAudioDone != null) {
      return responseAudioDone(
          eventId, type, responseId, itemId, outputIndex, contentIndex);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseAudioDone(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseAudioDone?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseAudioDone != null) {
      return responseAudioDone(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseAudioDoneImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseAudioDone extends RealtimeEvent {
  const factory RealtimeEventResponseAudioDone(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'response_id') required final String responseId,
          @JsonKey(name: 'item_id') required final String itemId,
          @JsonKey(name: 'output_index') required final int outputIndex,
          @JsonKey(name: 'content_index') required final int contentIndex}) =
      _$RealtimeEventResponseAudioDoneImpl;
  const RealtimeEventResponseAudioDone._() : super._();

  factory RealtimeEventResponseAudioDone.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventResponseAudioDoneImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the response.
  @JsonKey(name: 'response_id')
  String get responseId;

  /// The ID of the item.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// The index of the output item in the response.
  @JsonKey(name: 'output_index')
  int get outputIndex;

  /// The index of the content part in the item's content array.
  @JsonKey(name: 'content_index')
  int get contentIndex;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseAudioDoneImplCopyWith<
          _$RealtimeEventResponseAudioDoneImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWith(
          _$RealtimeEventResponseAudioTranscriptDeltaImpl value,
          $Res Function(_$RealtimeEventResponseAudioTranscriptDeltaImpl) then) =
      __$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'response_id') String responseId,
      @JsonKey(name: 'item_id') String itemId,
      @JsonKey(name: 'output_index') int outputIndex,
      @JsonKey(name: 'content_index') int contentIndex,
      String delta});
}

/// @nodoc
class __$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventResponseAudioTranscriptDeltaImpl>
    implements _$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWith<$Res> {
  __$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWithImpl(
      _$RealtimeEventResponseAudioTranscriptDeltaImpl _value,
      $Res Function(_$RealtimeEventResponseAudioTranscriptDeltaImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? responseId = null,
    Object? itemId = null,
    Object? outputIndex = null,
    Object? contentIndex = null,
    Object? delta = null,
  }) {
    return _then(_$RealtimeEventResponseAudioTranscriptDeltaImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      responseId: null == responseId
          ? _value.responseId
          : responseId // ignore: cast_nullable_to_non_nullable
              as String,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
      outputIndex: null == outputIndex
          ? _value.outputIndex
          : outputIndex // ignore: cast_nullable_to_non_nullable
              as int,
      contentIndex: null == contentIndex
          ? _value.contentIndex
          : contentIndex // ignore: cast_nullable_to_non_nullable
              as int,
      delta: null == delta
          ? _value.delta
          : delta // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseAudioTranscriptDeltaImpl
    extends RealtimeEventResponseAudioTranscriptDelta {
  const _$RealtimeEventResponseAudioTranscriptDeltaImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseAudioTranscriptDelta,
      @JsonKey(name: 'response_id') required this.responseId,
      @JsonKey(name: 'item_id') required this.itemId,
      @JsonKey(name: 'output_index') required this.outputIndex,
      @JsonKey(name: 'content_index') required this.contentIndex,
      required this.delta})
      : super._();

  factory _$RealtimeEventResponseAudioTranscriptDeltaImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseAudioTranscriptDeltaImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the response.
  @override
  @JsonKey(name: 'response_id')
  final String responseId;

  /// The ID of the item.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  /// The index of the output item in the response.
  @override
  @JsonKey(name: 'output_index')
  final int outputIndex;

  /// The index of the content part in the item's content array.
  @override
  @JsonKey(name: 'content_index')
  final int contentIndex;

  /// The transcript delta.
  @override
  final String delta;

  @override
  String toString() {
    return 'RealtimeEvent.responseAudioTranscriptDelta(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex, delta: $delta)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseAudioTranscriptDeltaImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.responseId, responseId) ||
                other.responseId == responseId) &&
            (identical(other.itemId, itemId) || other.itemId == itemId) &&
            (identical(other.outputIndex, outputIndex) ||
                other.outputIndex == outputIndex) &&
            (identical(other.contentIndex, contentIndex) ||
                other.contentIndex == contentIndex) &&
            (identical(other.delta, delta) || other.delta == delta));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, responseId,
      itemId, outputIndex, contentIndex, delta);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWith<
          _$RealtimeEventResponseAudioTranscriptDeltaImpl>
      get copyWith =>
          __$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWithImpl<
                  _$RealtimeEventResponseAudioTranscriptDeltaImpl>(
              this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseAudioTranscriptDelta(
        eventId, type, responseId, itemId, outputIndex, contentIndex, delta);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseAudioTranscriptDelta?.call(
        eventId, type, responseId, itemId, outputIndex, contentIndex, delta);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseAudioTranscriptDelta != null) {
      return responseAudioTranscriptDelta(
          eventId, type, responseId, itemId, outputIndex, contentIndex, delta);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseAudioTranscriptDelta(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseAudioTranscriptDelta?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseAudioTranscriptDelta != null) {
      return responseAudioTranscriptDelta(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseAudioTranscriptDeltaImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseAudioTranscriptDelta extends RealtimeEvent {
  const factory RealtimeEventResponseAudioTranscriptDelta(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'response_id') required final String responseId,
          @JsonKey(name: 'item_id') required final String itemId,
          @JsonKey(name: 'output_index') required final int outputIndex,
          @JsonKey(name: 'content_index') required final int contentIndex,
          required final String delta}) =
      _$RealtimeEventResponseAudioTranscriptDeltaImpl;
  const RealtimeEventResponseAudioTranscriptDelta._() : super._();

  factory RealtimeEventResponseAudioTranscriptDelta.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventResponseAudioTranscriptDeltaImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the response.
  @JsonKey(name: 'response_id')
  String get responseId;

  /// The ID of the item.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// The index of the output item in the response.
  @JsonKey(name: 'output_index')
  int get outputIndex;

  /// The index of the content part in the item's content array.
  @JsonKey(name: 'content_index')
  int get contentIndex;

  /// The transcript delta.
  String get delta;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWith<
          _$RealtimeEventResponseAudioTranscriptDeltaImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseAudioTranscriptDoneImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseAudioTranscriptDoneImplCopyWith(
          _$RealtimeEventResponseAudioTranscriptDoneImpl value,
          $Res Function(_$RealtimeEventResponseAudioTranscriptDoneImpl) then) =
      __$$RealtimeEventResponseAudioTranscriptDoneImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'response_id') String responseId,
      @JsonKey(name: 'item_id') String itemId,
      @JsonKey(name: 'output_index') int outputIndex,
      @JsonKey(name: 'content_index') int contentIndex,
      String transcript});
}

/// @nodoc
class __$$RealtimeEventResponseAudioTranscriptDoneImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventResponseAudioTranscriptDoneImpl>
    implements _$$RealtimeEventResponseAudioTranscriptDoneImplCopyWith<$Res> {
  __$$RealtimeEventResponseAudioTranscriptDoneImplCopyWithImpl(
      _$RealtimeEventResponseAudioTranscriptDoneImpl _value,
      $Res Function(_$RealtimeEventResponseAudioTranscriptDoneImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? responseId = null,
    Object? itemId = null,
    Object? outputIndex = null,
    Object? contentIndex = null,
    Object? transcript = null,
  }) {
    return _then(_$RealtimeEventResponseAudioTranscriptDoneImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      responseId: null == responseId
          ? _value.responseId
          : responseId // ignore: cast_nullable_to_non_nullable
              as String,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
      outputIndex: null == outputIndex
          ? _value.outputIndex
          : outputIndex // ignore: cast_nullable_to_non_nullable
              as int,
      contentIndex: null == contentIndex
          ? _value.contentIndex
          : contentIndex // ignore: cast_nullable_to_non_nullable
              as int,
      transcript: null == transcript
          ? _value.transcript
          : transcript // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseAudioTranscriptDoneImpl
    extends RealtimeEventResponseAudioTranscriptDone {
  const _$RealtimeEventResponseAudioTranscriptDoneImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseAudioTranscriptDone,
      @JsonKey(name: 'response_id') required this.responseId,
      @JsonKey(name: 'item_id') required this.itemId,
      @JsonKey(name: 'output_index') required this.outputIndex,
      @JsonKey(name: 'content_index') required this.contentIndex,
      required this.transcript})
      : super._();

  factory _$RealtimeEventResponseAudioTranscriptDoneImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseAudioTranscriptDoneImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the response.
  @override
  @JsonKey(name: 'response_id')
  final String responseId;

  /// The ID of the item.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  /// The index of the output item in the response.
  @override
  @JsonKey(name: 'output_index')
  final int outputIndex;

  /// The index of the content part in the item's content array.
  @override
  @JsonKey(name: 'content_index')
  final int contentIndex;

  /// The final transcript of the audio.
  @override
  final String transcript;

  @override
  String toString() {
    return 'RealtimeEvent.responseAudioTranscriptDone(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex, transcript: $transcript)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseAudioTranscriptDoneImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.responseId, responseId) ||
                other.responseId == responseId) &&
            (identical(other.itemId, itemId) || other.itemId == itemId) &&
            (identical(other.outputIndex, outputIndex) ||
                other.outputIndex == outputIndex) &&
            (identical(other.contentIndex, contentIndex) ||
                other.contentIndex == contentIndex) &&
            (identical(other.transcript, transcript) ||
                other.transcript == transcript));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, responseId,
      itemId, outputIndex, contentIndex, transcript);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseAudioTranscriptDoneImplCopyWith<
          _$RealtimeEventResponseAudioTranscriptDoneImpl>
      get copyWith =>
          __$$RealtimeEventResponseAudioTranscriptDoneImplCopyWithImpl<
              _$RealtimeEventResponseAudioTranscriptDoneImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseAudioTranscriptDone(eventId, type, responseId, itemId,
        outputIndex, contentIndex, transcript);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseAudioTranscriptDone?.call(eventId, type, responseId, itemId,
        outputIndex, contentIndex, transcript);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseAudioTranscriptDone != null) {
      return responseAudioTranscriptDone(eventId, type, responseId, itemId,
          outputIndex, contentIndex, transcript);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseAudioTranscriptDone(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseAudioTranscriptDone?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseAudioTranscriptDone != null) {
      return responseAudioTranscriptDone(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseAudioTranscriptDoneImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseAudioTranscriptDone extends RealtimeEvent {
  const factory RealtimeEventResponseAudioTranscriptDone(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'response_id') required final String responseId,
          @JsonKey(name: 'item_id') required final String itemId,
          @JsonKey(name: 'output_index') required final int outputIndex,
          @JsonKey(name: 'content_index') required final int contentIndex,
          required final String transcript}) =
      _$RealtimeEventResponseAudioTranscriptDoneImpl;
  const RealtimeEventResponseAudioTranscriptDone._() : super._();

  factory RealtimeEventResponseAudioTranscriptDone.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventResponseAudioTranscriptDoneImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the response.
  @JsonKey(name: 'response_id')
  String get responseId;

  /// The ID of the item.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// The index of the output item in the response.
  @JsonKey(name: 'output_index')
  int get outputIndex;

  /// The index of the content part in the item's content array.
  @JsonKey(name: 'content_index')
  int get contentIndex;

  /// The final transcript of the audio.
  String get transcript;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseAudioTranscriptDoneImplCopyWith<
          _$RealtimeEventResponseAudioTranscriptDoneImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseContentPartAddedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseContentPartAddedImplCopyWith(
          _$RealtimeEventResponseContentPartAddedImpl value,
          $Res Function(_$RealtimeEventResponseContentPartAddedImpl) then) =
      __$$RealtimeEventResponseContentPartAddedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'response_id') String responseId,
      @JsonKey(name: 'item_id') String itemId,
      @JsonKey(name: 'output_index') int outputIndex,
      @JsonKey(name: 'content_index') int contentIndex,
      ContentPart part});

  $ContentPartCopyWith<$Res> get part;
}

/// @nodoc
class __$$RealtimeEventResponseContentPartAddedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventResponseContentPartAddedImpl>
    implements _$$RealtimeEventResponseContentPartAddedImplCopyWith<$Res> {
  __$$RealtimeEventResponseContentPartAddedImplCopyWithImpl(
      _$RealtimeEventResponseContentPartAddedImpl _value,
      $Res Function(_$RealtimeEventResponseContentPartAddedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? responseId = null,
    Object? itemId = null,
    Object? outputIndex = null,
    Object? contentIndex = null,
    Object? part = null,
  }) {
    return _then(_$RealtimeEventResponseContentPartAddedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      responseId: null == responseId
          ? _value.responseId
          : responseId // ignore: cast_nullable_to_non_nullable
              as String,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
      outputIndex: null == outputIndex
          ? _value.outputIndex
          : outputIndex // ignore: cast_nullable_to_non_nullable
              as int,
      contentIndex: null == contentIndex
          ? _value.contentIndex
          : contentIndex // ignore: cast_nullable_to_non_nullable
              as int,
      part: null == part
          ? _value.part
          : part // ignore: cast_nullable_to_non_nullable
              as ContentPart,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ContentPartCopyWith<$Res> get part {
    return $ContentPartCopyWith<$Res>(_value.part, (value) {
      return _then(_value.copyWith(part: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseContentPartAddedImpl
    extends RealtimeEventResponseContentPartAdded {
  const _$RealtimeEventResponseContentPartAddedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseContentPartAdded,
      @JsonKey(name: 'response_id') required this.responseId,
      @JsonKey(name: 'item_id') required this.itemId,
      @JsonKey(name: 'output_index') required this.outputIndex,
      @JsonKey(name: 'content_index') required this.contentIndex,
      required this.part})
      : super._();

  factory _$RealtimeEventResponseContentPartAddedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseContentPartAddedImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the response.
  @override
  @JsonKey(name: 'response_id')
  final String responseId;

  /// The ID of the item to which the content part was added.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  /// The index of the output item in the response.
  @override
  @JsonKey(name: 'output_index')
  final int outputIndex;

  /// The index of the content part in the item's content array.
  @override
  @JsonKey(name: 'content_index')
  final int contentIndex;

  /// A part of the content.
  /// Any of: [ContentPartInputText], [ContentPartInputAudio], [ContentPartText], [ContentPartAudio]
  @override
  final ContentPart part;

  @override
  String toString() {
    return 'RealtimeEvent.responseContentPartAdded(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex, part: $part)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseContentPartAddedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.responseId, responseId) ||
                other.responseId == responseId) &&
            (identical(other.itemId, itemId) || other.itemId == itemId) &&
            (identical(other.outputIndex, outputIndex) ||
                other.outputIndex == outputIndex) &&
            (identical(other.contentIndex, contentIndex) ||
                other.contentIndex == contentIndex) &&
            (identical(other.part, part) || other.part == part));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, responseId,
      itemId, outputIndex, contentIndex, part);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseContentPartAddedImplCopyWith<
          _$RealtimeEventResponseContentPartAddedImpl>
      get copyWith => __$$RealtimeEventResponseContentPartAddedImplCopyWithImpl<
          _$RealtimeEventResponseContentPartAddedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseContentPartAdded(
        eventId, type, responseId, itemId, outputIndex, contentIndex, part);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseContentPartAdded?.call(
        eventId, type, responseId, itemId, outputIndex, contentIndex, part);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseContentPartAdded != null) {
      return responseContentPartAdded(
          eventId, type, responseId, itemId, outputIndex, contentIndex, part);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseContentPartAdded(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseContentPartAdded?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseContentPartAdded != null) {
      return responseContentPartAdded(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseContentPartAddedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseContentPartAdded extends RealtimeEvent {
  const factory RealtimeEventResponseContentPartAdded(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'response_id') required final String responseId,
          @JsonKey(name: 'item_id') required final String itemId,
          @JsonKey(name: 'output_index') required final int outputIndex,
          @JsonKey(name: 'content_index') required final int contentIndex,
          required final ContentPart part}) =
      _$RealtimeEventResponseContentPartAddedImpl;
  const RealtimeEventResponseContentPartAdded._() : super._();

  factory RealtimeEventResponseContentPartAdded.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventResponseContentPartAddedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the response.
  @JsonKey(name: 'response_id')
  String get responseId;

  /// The ID of the item to which the content part was added.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// The index of the output item in the response.
  @JsonKey(name: 'output_index')
  int get outputIndex;

  /// The index of the content part in the item's content array.
  @JsonKey(name: 'content_index')
  int get contentIndex;

  /// A part of the content.
  /// Any of: [ContentPartInputText], [ContentPartInputAudio], [ContentPartText], [ContentPartAudio]
  ContentPart get part;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseContentPartAddedImplCopyWith<
          _$RealtimeEventResponseContentPartAddedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseContentPartDoneImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseContentPartDoneImplCopyWith(
          _$RealtimeEventResponseContentPartDoneImpl value,
          $Res Function(_$RealtimeEventResponseContentPartDoneImpl) then) =
      __$$RealtimeEventResponseContentPartDoneImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'response_id') String responseId,
      @JsonKey(name: 'item_id') String itemId,
      @JsonKey(name: 'output_index') int outputIndex,
      @JsonKey(name: 'content_index') int contentIndex,
      ContentPart part});

  $ContentPartCopyWith<$Res> get part;
}

/// @nodoc
class __$$RealtimeEventResponseContentPartDoneImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventResponseContentPartDoneImpl>
    implements _$$RealtimeEventResponseContentPartDoneImplCopyWith<$Res> {
  __$$RealtimeEventResponseContentPartDoneImplCopyWithImpl(
      _$RealtimeEventResponseContentPartDoneImpl _value,
      $Res Function(_$RealtimeEventResponseContentPartDoneImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? responseId = null,
    Object? itemId = null,
    Object? outputIndex = null,
    Object? contentIndex = null,
    Object? part = null,
  }) {
    return _then(_$RealtimeEventResponseContentPartDoneImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      responseId: null == responseId
          ? _value.responseId
          : responseId // ignore: cast_nullable_to_non_nullable
              as String,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
      outputIndex: null == outputIndex
          ? _value.outputIndex
          : outputIndex // ignore: cast_nullable_to_non_nullable
              as int,
      contentIndex: null == contentIndex
          ? _value.contentIndex
          : contentIndex // ignore: cast_nullable_to_non_nullable
              as int,
      part: null == part
          ? _value.part
          : part // ignore: cast_nullable_to_non_nullable
              as ContentPart,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ContentPartCopyWith<$Res> get part {
    return $ContentPartCopyWith<$Res>(_value.part, (value) {
      return _then(_value.copyWith(part: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseContentPartDoneImpl
    extends RealtimeEventResponseContentPartDone {
  const _$RealtimeEventResponseContentPartDoneImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseContentPartDone,
      @JsonKey(name: 'response_id') required this.responseId,
      @JsonKey(name: 'item_id') required this.itemId,
      @JsonKey(name: 'output_index') required this.outputIndex,
      @JsonKey(name: 'content_index') required this.contentIndex,
      required this.part})
      : super._();

  factory _$RealtimeEventResponseContentPartDoneImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseContentPartDoneImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the response.
  @override
  @JsonKey(name: 'response_id')
  final String responseId;

  /// The ID of the item.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  /// The index of the output item in the response.
  @override
  @JsonKey(name: 'output_index')
  final int outputIndex;

  /// The index of the content part in the item's content array.
  @override
  @JsonKey(name: 'content_index')
  final int contentIndex;

  /// A part of the content.
  /// Any of: [ContentPartInputText], [ContentPartInputAudio], [ContentPartText], [ContentPartAudio]
  @override
  final ContentPart part;

  @override
  String toString() {
    return 'RealtimeEvent.responseContentPartDone(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex, part: $part)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseContentPartDoneImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.responseId, responseId) ||
                other.responseId == responseId) &&
            (identical(other.itemId, itemId) || other.itemId == itemId) &&
            (identical(other.outputIndex, outputIndex) ||
                other.outputIndex == outputIndex) &&
            (identical(other.contentIndex, contentIndex) ||
                other.contentIndex == contentIndex) &&
            (identical(other.part, part) || other.part == part));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, responseId,
      itemId, outputIndex, contentIndex, part);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseContentPartDoneImplCopyWith<
          _$RealtimeEventResponseContentPartDoneImpl>
      get copyWith => __$$RealtimeEventResponseContentPartDoneImplCopyWithImpl<
          _$RealtimeEventResponseContentPartDoneImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseContentPartDone(
        eventId, type, responseId, itemId, outputIndex, contentIndex, part);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseContentPartDone?.call(
        eventId, type, responseId, itemId, outputIndex, contentIndex, part);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseContentPartDone != null) {
      return responseContentPartDone(
          eventId, type, responseId, itemId, outputIndex, contentIndex, part);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseContentPartDone(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseContentPartDone?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseContentPartDone != null) {
      return responseContentPartDone(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseContentPartDoneImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseContentPartDone extends RealtimeEvent {
  const factory RealtimeEventResponseContentPartDone(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'response_id') required final String responseId,
          @JsonKey(name: 'item_id') required final String itemId,
          @JsonKey(name: 'output_index') required final int outputIndex,
          @JsonKey(name: 'content_index') required final int contentIndex,
          required final ContentPart part}) =
      _$RealtimeEventResponseContentPartDoneImpl;
  const RealtimeEventResponseContentPartDone._() : super._();

  factory RealtimeEventResponseContentPartDone.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventResponseContentPartDoneImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the response.
  @JsonKey(name: 'response_id')
  String get responseId;

  /// The ID of the item.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// The index of the output item in the response.
  @JsonKey(name: 'output_index')
  int get outputIndex;

  /// The index of the content part in the item's content array.
  @JsonKey(name: 'content_index')
  int get contentIndex;

  /// A part of the content.
  /// Any of: [ContentPartInputText], [ContentPartInputAudio], [ContentPartText], [ContentPartAudio]
  ContentPart get part;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseContentPartDoneImplCopyWith<
          _$RealtimeEventResponseContentPartDoneImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseCreatedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseCreatedImplCopyWith(
          _$RealtimeEventResponseCreatedImpl value,
          $Res Function(_$RealtimeEventResponseCreatedImpl) then) =
      __$$RealtimeEventResponseCreatedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      Response response});

  $ResponseCopyWith<$Res> get response;
}

/// @nodoc
class __$$RealtimeEventResponseCreatedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventResponseCreatedImpl>
    implements _$$RealtimeEventResponseCreatedImplCopyWith<$Res> {
  __$$RealtimeEventResponseCreatedImplCopyWithImpl(
      _$RealtimeEventResponseCreatedImpl _value,
      $Res Function(_$RealtimeEventResponseCreatedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? response = null,
  }) {
    return _then(_$RealtimeEventResponseCreatedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      response: null == response
          ? _value.response
          : response // ignore: cast_nullable_to_non_nullable
              as Response,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ResponseCopyWith<$Res> get response {
    return $ResponseCopyWith<$Res>(_value.response, (value) {
      return _then(_value.copyWith(response: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseCreatedImpl extends RealtimeEventResponseCreated {
  const _$RealtimeEventResponseCreatedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseCreated,
      required this.response})
      : super._();

  factory _$RealtimeEventResponseCreatedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseCreatedImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The response resource.
  @override
  final Response response;

  @override
  String toString() {
    return 'RealtimeEvent.responseCreated(eventId: $eventId, type: $type, response: $response)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseCreatedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.response, response) ||
                other.response == response));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, response);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseCreatedImplCopyWith<
          _$RealtimeEventResponseCreatedImpl>
      get copyWith => __$$RealtimeEventResponseCreatedImplCopyWithImpl<
          _$RealtimeEventResponseCreatedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseCreated(eventId, type, response);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseCreated?.call(eventId, type, response);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseCreated != null) {
      return responseCreated(eventId, type, response);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseCreated(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseCreated?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseCreated != null) {
      return responseCreated(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseCreatedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseCreated extends RealtimeEvent {
  const factory RealtimeEventResponseCreated(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      required final Response response}) = _$RealtimeEventResponseCreatedImpl;
  const RealtimeEventResponseCreated._() : super._();

  factory RealtimeEventResponseCreated.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventResponseCreatedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The response resource.
  Response get response;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseCreatedImplCopyWith<
          _$RealtimeEventResponseCreatedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseDoneImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseDoneImplCopyWith(
          _$RealtimeEventResponseDoneImpl value,
          $Res Function(_$RealtimeEventResponseDoneImpl) then) =
      __$$RealtimeEventResponseDoneImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      Response response});

  $ResponseCopyWith<$Res> get response;
}

/// @nodoc
class __$$RealtimeEventResponseDoneImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventResponseDoneImpl>
    implements _$$RealtimeEventResponseDoneImplCopyWith<$Res> {
  __$$RealtimeEventResponseDoneImplCopyWithImpl(
      _$RealtimeEventResponseDoneImpl _value,
      $Res Function(_$RealtimeEventResponseDoneImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? response = null,
  }) {
    return _then(_$RealtimeEventResponseDoneImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      response: null == response
          ? _value.response
          : response // ignore: cast_nullable_to_non_nullable
              as Response,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ResponseCopyWith<$Res> get response {
    return $ResponseCopyWith<$Res>(_value.response, (value) {
      return _then(_value.copyWith(response: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseDoneImpl extends RealtimeEventResponseDone {
  const _$RealtimeEventResponseDoneImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseDone,
      required this.response})
      : super._();

  factory _$RealtimeEventResponseDoneImpl.fromJson(Map<String, dynamic> json) =>
      _$$RealtimeEventResponseDoneImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The response resource.
  @override
  final Response response;

  @override
  String toString() {
    return 'RealtimeEvent.responseDone(eventId: $eventId, type: $type, response: $response)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseDoneImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.response, response) ||
                other.response == response));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, response);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseDoneImplCopyWith<_$RealtimeEventResponseDoneImpl>
      get copyWith => __$$RealtimeEventResponseDoneImplCopyWithImpl<
          _$RealtimeEventResponseDoneImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseDone(eventId, type, response);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseDone?.call(eventId, type, response);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseDone != null) {
      return responseDone(eventId, type, response);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseDone(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseDone?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseDone != null) {
      return responseDone(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseDoneImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseDone extends RealtimeEvent {
  const factory RealtimeEventResponseDone(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      required final Response response}) = _$RealtimeEventResponseDoneImpl;
  const RealtimeEventResponseDone._() : super._();

  factory RealtimeEventResponseDone.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventResponseDoneImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The response resource.
  Response get response;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseDoneImplCopyWith<_$RealtimeEventResponseDoneImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWith<
    $Res> implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWith(
          _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl value,
          $Res Function(_$RealtimeEventResponseFunctionCallArgumentsDeltaImpl)
              then) =
      __$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'response_id') String responseId,
      @JsonKey(name: 'item_id') String itemId,
      @JsonKey(name: 'output_index') int outputIndex,
      @JsonKey(name: 'call_id') String callId,
      String delta});
}

/// @nodoc
class __$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl>
    implements
        _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWith<$Res> {
  __$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWithImpl(
      _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl _value,
      $Res Function(_$RealtimeEventResponseFunctionCallArgumentsDeltaImpl)
          _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? responseId = null,
    Object? itemId = null,
    Object? outputIndex = null,
    Object? callId = null,
    Object? delta = null,
  }) {
    return _then(_$RealtimeEventResponseFunctionCallArgumentsDeltaImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      responseId: null == responseId
          ? _value.responseId
          : responseId // ignore: cast_nullable_to_non_nullable
              as String,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
      outputIndex: null == outputIndex
          ? _value.outputIndex
          : outputIndex // ignore: cast_nullable_to_non_nullable
              as int,
      callId: null == callId
          ? _value.callId
          : callId // ignore: cast_nullable_to_non_nullable
              as String,
      delta: null == delta
          ? _value.delta
          : delta // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl
    extends RealtimeEventResponseFunctionCallArgumentsDelta {
  const _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseFunctionCallArgumentsDelta,
      @JsonKey(name: 'response_id') required this.responseId,
      @JsonKey(name: 'item_id') required this.itemId,
      @JsonKey(name: 'output_index') required this.outputIndex,
      @JsonKey(name: 'call_id') required this.callId,
      required this.delta})
      : super._();

  factory _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the response.
  @override
  @JsonKey(name: 'response_id')
  final String responseId;

  /// The ID of the function call item.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  /// The index of the output item in the response.
  @override
  @JsonKey(name: 'output_index')
  final int outputIndex;

  /// The ID of the function call.
  @override
  @JsonKey(name: 'call_id')
  final String callId;

  /// The arguments delta as a JSON string.
  @override
  final String delta;

  @override
  String toString() {
    return 'RealtimeEvent.responseFunctionCallArgumentsDelta(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, callId: $callId, delta: $delta)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.responseId, responseId) ||
                other.responseId == responseId) &&
            (identical(other.itemId, itemId) || other.itemId == itemId) &&
            (identical(other.outputIndex, outputIndex) ||
                other.outputIndex == outputIndex) &&
            (identical(other.callId, callId) || other.callId == callId) &&
            (identical(other.delta, delta) || other.delta == delta));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, responseId,
      itemId, outputIndex, callId, delta);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWith<
          _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl>
      get copyWith =>
          __$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWithImpl<
                  _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl>(
              this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseFunctionCallArgumentsDelta(
        eventId, type, responseId, itemId, outputIndex, callId, delta);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseFunctionCallArgumentsDelta?.call(
        eventId, type, responseId, itemId, outputIndex, callId, delta);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseFunctionCallArgumentsDelta != null) {
      return responseFunctionCallArgumentsDelta(
          eventId, type, responseId, itemId, outputIndex, callId, delta);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseFunctionCallArgumentsDelta(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseFunctionCallArgumentsDelta?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseFunctionCallArgumentsDelta != null) {
      return responseFunctionCallArgumentsDelta(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseFunctionCallArgumentsDelta
    extends RealtimeEvent {
  const factory RealtimeEventResponseFunctionCallArgumentsDelta(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'response_id') required final String responseId,
          @JsonKey(name: 'item_id') required final String itemId,
          @JsonKey(name: 'output_index') required final int outputIndex,
          @JsonKey(name: 'call_id') required final String callId,
          required final String delta}) =
      _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl;
  const RealtimeEventResponseFunctionCallArgumentsDelta._() : super._();

  factory RealtimeEventResponseFunctionCallArgumentsDelta.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the response.
  @JsonKey(name: 'response_id')
  String get responseId;

  /// The ID of the function call item.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// The index of the output item in the response.
  @JsonKey(name: 'output_index')
  int get outputIndex;

  /// The ID of the function call.
  @JsonKey(name: 'call_id')
  String get callId;

  /// The arguments delta as a JSON string.
  String get delta;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWith<
          _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWith<
    $Res> implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWith(
          _$RealtimeEventResponseFunctionCallArgumentsDoneImpl value,
          $Res Function(_$RealtimeEventResponseFunctionCallArgumentsDoneImpl)
              then) =
      __$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'response_id') String responseId,
      @JsonKey(name: 'item_id') String itemId,
      @JsonKey(name: 'output_index') int outputIndex,
      @JsonKey(name: 'call_id') String callId,
      String arguments});
}

/// @nodoc
class __$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventResponseFunctionCallArgumentsDoneImpl>
    implements
        _$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWith<$Res> {
  __$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWithImpl(
      _$RealtimeEventResponseFunctionCallArgumentsDoneImpl _value,
      $Res Function(_$RealtimeEventResponseFunctionCallArgumentsDoneImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? responseId = null,
    Object? itemId = null,
    Object? outputIndex = null,
    Object? callId = null,
    Object? arguments = null,
  }) {
    return _then(_$RealtimeEventResponseFunctionCallArgumentsDoneImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      responseId: null == responseId
          ? _value.responseId
          : responseId // ignore: cast_nullable_to_non_nullable
              as String,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
      outputIndex: null == outputIndex
          ? _value.outputIndex
          : outputIndex // ignore: cast_nullable_to_non_nullable
              as int,
      callId: null == callId
          ? _value.callId
          : callId // ignore: cast_nullable_to_non_nullable
              as String,
      arguments: null == arguments
          ? _value.arguments
          : arguments // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseFunctionCallArgumentsDoneImpl
    extends RealtimeEventResponseFunctionCallArgumentsDone {
  const _$RealtimeEventResponseFunctionCallArgumentsDoneImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseFunctionCallArgumentsDone,
      @JsonKey(name: 'response_id') required this.responseId,
      @JsonKey(name: 'item_id') required this.itemId,
      @JsonKey(name: 'output_index') required this.outputIndex,
      @JsonKey(name: 'call_id') required this.callId,
      required this.arguments})
      : super._();

  factory _$RealtimeEventResponseFunctionCallArgumentsDoneImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseFunctionCallArgumentsDoneImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the response.
  @override
  @JsonKey(name: 'response_id')
  final String responseId;

  /// The ID of the function call item.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  /// The index of the output item in the response.
  @override
  @JsonKey(name: 'output_index')
  final int outputIndex;

  /// The ID of the function call.
  @override
  @JsonKey(name: 'call_id')
  final String callId;

  /// The final arguments as a JSON string.
  @override
  final String arguments;

  @override
  String toString() {
    return 'RealtimeEvent.responseFunctionCallArgumentsDone(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, callId: $callId, arguments: $arguments)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseFunctionCallArgumentsDoneImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.responseId, responseId) ||
                other.responseId == responseId) &&
            (identical(other.itemId, itemId) || other.itemId == itemId) &&
            (identical(other.outputIndex, outputIndex) ||
                other.outputIndex == outputIndex) &&
            (identical(other.callId, callId) || other.callId == callId) &&
            (identical(other.arguments, arguments) ||
                other.arguments == arguments));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, responseId,
      itemId, outputIndex, callId, arguments);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWith<
          _$RealtimeEventResponseFunctionCallArgumentsDoneImpl>
      get copyWith =>
          __$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWithImpl<
                  _$RealtimeEventResponseFunctionCallArgumentsDoneImpl>(
              this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseFunctionCallArgumentsDone(
        eventId, type, responseId, itemId, outputIndex, callId, arguments);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseFunctionCallArgumentsDone?.call(
        eventId, type, responseId, itemId, outputIndex, callId, arguments);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseFunctionCallArgumentsDone != null) {
      return responseFunctionCallArgumentsDone(
          eventId, type, responseId, itemId, outputIndex, callId, arguments);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseFunctionCallArgumentsDone(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseFunctionCallArgumentsDone?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseFunctionCallArgumentsDone != null) {
      return responseFunctionCallArgumentsDone(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseFunctionCallArgumentsDoneImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseFunctionCallArgumentsDone
    extends RealtimeEvent {
  const factory RealtimeEventResponseFunctionCallArgumentsDone(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          @JsonKey(name: 'response_id') required final String responseId,
          @JsonKey(name: 'item_id') required final String itemId,
          @JsonKey(name: 'output_index') required final int outputIndex,
          @JsonKey(name: 'call_id') required final String callId,
          required final String arguments}) =
      _$RealtimeEventResponseFunctionCallArgumentsDoneImpl;
  const RealtimeEventResponseFunctionCallArgumentsDone._() : super._();

  factory RealtimeEventResponseFunctionCallArgumentsDone.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventResponseFunctionCallArgumentsDoneImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the response.
  @JsonKey(name: 'response_id')
  String get responseId;

  /// The ID of the function call item.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// The index of the output item in the response.
  @JsonKey(name: 'output_index')
  int get outputIndex;

  /// The ID of the function call.
  @JsonKey(name: 'call_id')
  String get callId;

  /// The final arguments as a JSON string.
  String get arguments;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWith<
          _$RealtimeEventResponseFunctionCallArgumentsDoneImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseOutputItemAddedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseOutputItemAddedImplCopyWith(
          _$RealtimeEventResponseOutputItemAddedImpl value,
          $Res Function(_$RealtimeEventResponseOutputItemAddedImpl) then) =
      __$$RealtimeEventResponseOutputItemAddedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'response_id') String responseId,
      @JsonKey(name: 'output_index') int outputIndex,
      Item item});

  $ItemCopyWith<$Res> get item;
}

/// @nodoc
class __$$RealtimeEventResponseOutputItemAddedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventResponseOutputItemAddedImpl>
    implements _$$RealtimeEventResponseOutputItemAddedImplCopyWith<$Res> {
  __$$RealtimeEventResponseOutputItemAddedImplCopyWithImpl(
      _$RealtimeEventResponseOutputItemAddedImpl _value,
      $Res Function(_$RealtimeEventResponseOutputItemAddedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? responseId = null,
    Object? outputIndex = null,
    Object? item = null,
  }) {
    return _then(_$RealtimeEventResponseOutputItemAddedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      responseId: null == responseId
          ? _value.responseId
          : responseId // ignore: cast_nullable_to_non_nullable
              as String,
      outputIndex: null == outputIndex
          ? _value.outputIndex
          : outputIndex // ignore: cast_nullable_to_non_nullable
              as int,
      item: null == item
          ? _value.item
          : item // ignore: cast_nullable_to_non_nullable
              as Item,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ItemCopyWith<$Res> get item {
    return $ItemCopyWith<$Res>(_value.item, (value) {
      return _then(_value.copyWith(item: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseOutputItemAddedImpl
    extends RealtimeEventResponseOutputItemAdded {
  const _$RealtimeEventResponseOutputItemAddedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseOutputItemAdded,
      @JsonKey(name: 'response_id') required this.responseId,
      @JsonKey(name: 'output_index') required this.outputIndex,
      required this.item})
      : super._();

  factory _$RealtimeEventResponseOutputItemAddedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseOutputItemAddedImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the Response to which the item belongs.
  @override
  @JsonKey(name: 'response_id')
  final String responseId;

  /// The index of the output item in the Response.
  @override
  @JsonKey(name: 'output_index')
  final int outputIndex;

  /// The item to add to the conversation.
  /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput]
  @override
  final Item item;

  @override
  String toString() {
    return 'RealtimeEvent.responseOutputItemAdded(eventId: $eventId, type: $type, responseId: $responseId, outputIndex: $outputIndex, item: $item)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseOutputItemAddedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.responseId, responseId) ||
                other.responseId == responseId) &&
            (identical(other.outputIndex, outputIndex) ||
                other.outputIndex == outputIndex) &&
            (identical(other.item, item) || other.item == item));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, eventId, type, responseId, outputIndex, item);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseOutputItemAddedImplCopyWith<
          _$RealtimeEventResponseOutputItemAddedImpl>
      get copyWith => __$$RealtimeEventResponseOutputItemAddedImplCopyWithImpl<
          _$RealtimeEventResponseOutputItemAddedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseOutputItemAdded(
        eventId, type, responseId, outputIndex, item);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseOutputItemAdded?.call(
        eventId, type, responseId, outputIndex, item);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseOutputItemAdded != null) {
      return responseOutputItemAdded(
          eventId, type, responseId, outputIndex, item);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseOutputItemAdded(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseOutputItemAdded?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseOutputItemAdded != null) {
      return responseOutputItemAdded(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseOutputItemAddedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseOutputItemAdded extends RealtimeEvent {
  const factory RealtimeEventResponseOutputItemAdded(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      @JsonKey(name: 'response_id') required final String responseId,
      @JsonKey(name: 'output_index') required final int outputIndex,
      required final Item item}) = _$RealtimeEventResponseOutputItemAddedImpl;
  const RealtimeEventResponseOutputItemAdded._() : super._();

  factory RealtimeEventResponseOutputItemAdded.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventResponseOutputItemAddedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the Response to which the item belongs.
  @JsonKey(name: 'response_id')
  String get responseId;

  /// The index of the output item in the Response.
  @JsonKey(name: 'output_index')
  int get outputIndex;

  /// The item to add to the conversation.
  /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput]
  Item get item;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseOutputItemAddedImplCopyWith<
          _$RealtimeEventResponseOutputItemAddedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseOutputItemDoneImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseOutputItemDoneImplCopyWith(
          _$RealtimeEventResponseOutputItemDoneImpl value,
          $Res Function(_$RealtimeEventResponseOutputItemDoneImpl) then) =
      __$$RealtimeEventResponseOutputItemDoneImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'response_id') String responseId,
      @JsonKey(name: 'output_index') int outputIndex,
      Item item});

  $ItemCopyWith<$Res> get item;
}

/// @nodoc
class __$$RealtimeEventResponseOutputItemDoneImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventResponseOutputItemDoneImpl>
    implements _$$RealtimeEventResponseOutputItemDoneImplCopyWith<$Res> {
  __$$RealtimeEventResponseOutputItemDoneImplCopyWithImpl(
      _$RealtimeEventResponseOutputItemDoneImpl _value,
      $Res Function(_$RealtimeEventResponseOutputItemDoneImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? responseId = null,
    Object? outputIndex = null,
    Object? item = null,
  }) {
    return _then(_$RealtimeEventResponseOutputItemDoneImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      responseId: null == responseId
          ? _value.responseId
          : responseId // ignore: cast_nullable_to_non_nullable
              as String,
      outputIndex: null == outputIndex
          ? _value.outputIndex
          : outputIndex // ignore: cast_nullable_to_non_nullable
              as int,
      item: null == item
          ? _value.item
          : item // ignore: cast_nullable_to_non_nullable
              as Item,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $ItemCopyWith<$Res> get item {
    return $ItemCopyWith<$Res>(_value.item, (value) {
      return _then(_value.copyWith(item: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseOutputItemDoneImpl
    extends RealtimeEventResponseOutputItemDone {
  const _$RealtimeEventResponseOutputItemDoneImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseOutputItemDone,
      @JsonKey(name: 'response_id') required this.responseId,
      @JsonKey(name: 'output_index') required this.outputIndex,
      required this.item})
      : super._();

  factory _$RealtimeEventResponseOutputItemDoneImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseOutputItemDoneImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the Response to which the item belongs.
  @override
  @JsonKey(name: 'response_id')
  final String responseId;

  /// The index of the output item in the Response.
  @override
  @JsonKey(name: 'output_index')
  final int outputIndex;

  /// The item to add to the conversation.
  /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput]
  @override
  final Item item;

  @override
  String toString() {
    return 'RealtimeEvent.responseOutputItemDone(eventId: $eventId, type: $type, responseId: $responseId, outputIndex: $outputIndex, item: $item)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseOutputItemDoneImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.responseId, responseId) ||
                other.responseId == responseId) &&
            (identical(other.outputIndex, outputIndex) ||
                other.outputIndex == outputIndex) &&
            (identical(other.item, item) || other.item == item));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode =>
      Object.hash(runtimeType, eventId, type, responseId, outputIndex, item);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseOutputItemDoneImplCopyWith<
          _$RealtimeEventResponseOutputItemDoneImpl>
      get copyWith => __$$RealtimeEventResponseOutputItemDoneImplCopyWithImpl<
          _$RealtimeEventResponseOutputItemDoneImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseOutputItemDone(eventId, type, responseId, outputIndex, item);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseOutputItemDone?.call(
        eventId, type, responseId, outputIndex, item);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseOutputItemDone != null) {
      return responseOutputItemDone(
          eventId, type, responseId, outputIndex, item);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseOutputItemDone(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseOutputItemDone?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseOutputItemDone != null) {
      return responseOutputItemDone(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseOutputItemDoneImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseOutputItemDone extends RealtimeEvent {
  const factory RealtimeEventResponseOutputItemDone(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      @JsonKey(name: 'response_id') required final String responseId,
      @JsonKey(name: 'output_index') required final int outputIndex,
      required final Item item}) = _$RealtimeEventResponseOutputItemDoneImpl;
  const RealtimeEventResponseOutputItemDone._() : super._();

  factory RealtimeEventResponseOutputItemDone.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventResponseOutputItemDoneImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the Response to which the item belongs.
  @JsonKey(name: 'response_id')
  String get responseId;

  /// The index of the output item in the Response.
  @JsonKey(name: 'output_index')
  int get outputIndex;

  /// The item to add to the conversation.
  /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput]
  Item get item;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseOutputItemDoneImplCopyWith<
          _$RealtimeEventResponseOutputItemDoneImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseTextDeltaImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseTextDeltaImplCopyWith(
          _$RealtimeEventResponseTextDeltaImpl value,
          $Res Function(_$RealtimeEventResponseTextDeltaImpl) then) =
      __$$RealtimeEventResponseTextDeltaImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'response_id') String responseId,
      @JsonKey(name: 'item_id') String itemId,
      @JsonKey(name: 'output_index') int outputIndex,
      @JsonKey(name: 'content_index') int contentIndex,
      String delta});
}

/// @nodoc
class __$$RealtimeEventResponseTextDeltaImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventResponseTextDeltaImpl>
    implements _$$RealtimeEventResponseTextDeltaImplCopyWith<$Res> {
  __$$RealtimeEventResponseTextDeltaImplCopyWithImpl(
      _$RealtimeEventResponseTextDeltaImpl _value,
      $Res Function(_$RealtimeEventResponseTextDeltaImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? responseId = null,
    Object? itemId = null,
    Object? outputIndex = null,
    Object? contentIndex = null,
    Object? delta = null,
  }) {
    return _then(_$RealtimeEventResponseTextDeltaImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      responseId: null == responseId
          ? _value.responseId
          : responseId // ignore: cast_nullable_to_non_nullable
              as String,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
      outputIndex: null == outputIndex
          ? _value.outputIndex
          : outputIndex // ignore: cast_nullable_to_non_nullable
              as int,
      contentIndex: null == contentIndex
          ? _value.contentIndex
          : contentIndex // ignore: cast_nullable_to_non_nullable
              as int,
      delta: null == delta
          ? _value.delta
          : delta // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseTextDeltaImpl
    extends RealtimeEventResponseTextDelta {
  const _$RealtimeEventResponseTextDeltaImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseTextDelta,
      @JsonKey(name: 'response_id') required this.responseId,
      @JsonKey(name: 'item_id') required this.itemId,
      @JsonKey(name: 'output_index') required this.outputIndex,
      @JsonKey(name: 'content_index') required this.contentIndex,
      required this.delta})
      : super._();

  factory _$RealtimeEventResponseTextDeltaImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseTextDeltaImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the response.
  @override
  @JsonKey(name: 'response_id')
  final String responseId;

  /// The ID of the item.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  /// The index of the output item in the response.
  @override
  @JsonKey(name: 'output_index')
  final int outputIndex;

  /// The index of the content part in the item's content array.
  @override
  @JsonKey(name: 'content_index')
  final int contentIndex;

  /// The text delta.
  @override
  final String delta;

  @override
  String toString() {
    return 'RealtimeEvent.responseTextDelta(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex, delta: $delta)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseTextDeltaImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.responseId, responseId) ||
                other.responseId == responseId) &&
            (identical(other.itemId, itemId) || other.itemId == itemId) &&
            (identical(other.outputIndex, outputIndex) ||
                other.outputIndex == outputIndex) &&
            (identical(other.contentIndex, contentIndex) ||
                other.contentIndex == contentIndex) &&
            (identical(other.delta, delta) || other.delta == delta));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, responseId,
      itemId, outputIndex, contentIndex, delta);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseTextDeltaImplCopyWith<
          _$RealtimeEventResponseTextDeltaImpl>
      get copyWith => __$$RealtimeEventResponseTextDeltaImplCopyWithImpl<
          _$RealtimeEventResponseTextDeltaImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseTextDelta(
        eventId, type, responseId, itemId, outputIndex, contentIndex, delta);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseTextDelta?.call(
        eventId, type, responseId, itemId, outputIndex, contentIndex, delta);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseTextDelta != null) {
      return responseTextDelta(
          eventId, type, responseId, itemId, outputIndex, contentIndex, delta);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseTextDelta(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseTextDelta?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseTextDelta != null) {
      return responseTextDelta(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseTextDeltaImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseTextDelta extends RealtimeEvent {
  const factory RealtimeEventResponseTextDelta(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      @JsonKey(name: 'response_id') required final String responseId,
      @JsonKey(name: 'item_id') required final String itemId,
      @JsonKey(name: 'output_index') required final int outputIndex,
      @JsonKey(name: 'content_index') required final int contentIndex,
      required final String delta}) = _$RealtimeEventResponseTextDeltaImpl;
  const RealtimeEventResponseTextDelta._() : super._();

  factory RealtimeEventResponseTextDelta.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventResponseTextDeltaImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the response.
  @JsonKey(name: 'response_id')
  String get responseId;

  /// The ID of the item.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// The index of the output item in the response.
  @JsonKey(name: 'output_index')
  int get outputIndex;

  /// The index of the content part in the item's content array.
  @JsonKey(name: 'content_index')
  int get contentIndex;

  /// The text delta.
  String get delta;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseTextDeltaImplCopyWith<
          _$RealtimeEventResponseTextDeltaImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventResponseTextDoneImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventResponseTextDoneImplCopyWith(
          _$RealtimeEventResponseTextDoneImpl value,
          $Res Function(_$RealtimeEventResponseTextDoneImpl) then) =
      __$$RealtimeEventResponseTextDoneImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      @JsonKey(name: 'response_id') String responseId,
      @JsonKey(name: 'item_id') String itemId,
      @JsonKey(name: 'output_index') int outputIndex,
      @JsonKey(name: 'content_index') int contentIndex,
      String text});
}

/// @nodoc
class __$$RealtimeEventResponseTextDoneImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventResponseTextDoneImpl>
    implements _$$RealtimeEventResponseTextDoneImplCopyWith<$Res> {
  __$$RealtimeEventResponseTextDoneImplCopyWithImpl(
      _$RealtimeEventResponseTextDoneImpl _value,
      $Res Function(_$RealtimeEventResponseTextDoneImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? responseId = null,
    Object? itemId = null,
    Object? outputIndex = null,
    Object? contentIndex = null,
    Object? text = null,
  }) {
    return _then(_$RealtimeEventResponseTextDoneImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      responseId: null == responseId
          ? _value.responseId
          : responseId // ignore: cast_nullable_to_non_nullable
              as String,
      itemId: null == itemId
          ? _value.itemId
          : itemId // ignore: cast_nullable_to_non_nullable
              as String,
      outputIndex: null == outputIndex
          ? _value.outputIndex
          : outputIndex // ignore: cast_nullable_to_non_nullable
              as int,
      contentIndex: null == contentIndex
          ? _value.contentIndex
          : contentIndex // ignore: cast_nullable_to_non_nullable
              as int,
      text: null == text
          ? _value.text
          : text // ignore: cast_nullable_to_non_nullable
              as String,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventResponseTextDoneImpl
    extends RealtimeEventResponseTextDone {
  const _$RealtimeEventResponseTextDoneImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.responseTextDone,
      @JsonKey(name: 'response_id') required this.responseId,
      @JsonKey(name: 'item_id') required this.itemId,
      @JsonKey(name: 'output_index') required this.outputIndex,
      @JsonKey(name: 'content_index') required this.contentIndex,
      required this.text})
      : super._();

  factory _$RealtimeEventResponseTextDoneImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventResponseTextDoneImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The ID of the response.
  @override
  @JsonKey(name: 'response_id')
  final String responseId;

  /// The ID of the item.
  @override
  @JsonKey(name: 'item_id')
  final String itemId;

  /// The index of the output item in the response.
  @override
  @JsonKey(name: 'output_index')
  final int outputIndex;

  /// The index of the content part in the item's content array.
  @override
  @JsonKey(name: 'content_index')
  final int contentIndex;

  /// The final text content.
  @override
  final String text;

  @override
  String toString() {
    return 'RealtimeEvent.responseTextDone(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex, text: $text)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventResponseTextDoneImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.responseId, responseId) ||
                other.responseId == responseId) &&
            (identical(other.itemId, itemId) || other.itemId == itemId) &&
            (identical(other.outputIndex, outputIndex) ||
                other.outputIndex == outputIndex) &&
            (identical(other.contentIndex, contentIndex) ||
                other.contentIndex == contentIndex) &&
            (identical(other.text, text) || other.text == text));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, responseId,
      itemId, outputIndex, contentIndex, text);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventResponseTextDoneImplCopyWith<
          _$RealtimeEventResponseTextDoneImpl>
      get copyWith => __$$RealtimeEventResponseTextDoneImplCopyWithImpl<
          _$RealtimeEventResponseTextDoneImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return responseTextDone(
        eventId, type, responseId, itemId, outputIndex, contentIndex, text);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return responseTextDone?.call(
        eventId, type, responseId, itemId, outputIndex, contentIndex, text);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (responseTextDone != null) {
      return responseTextDone(
          eventId, type, responseId, itemId, outputIndex, contentIndex, text);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return responseTextDone(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return responseTextDone?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (responseTextDone != null) {
      return responseTextDone(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventResponseTextDoneImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventResponseTextDone extends RealtimeEvent {
  const factory RealtimeEventResponseTextDone(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      @JsonKey(name: 'response_id') required final String responseId,
      @JsonKey(name: 'item_id') required final String itemId,
      @JsonKey(name: 'output_index') required final int outputIndex,
      @JsonKey(name: 'content_index') required final int contentIndex,
      required final String text}) = _$RealtimeEventResponseTextDoneImpl;
  const RealtimeEventResponseTextDone._() : super._();

  factory RealtimeEventResponseTextDone.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventResponseTextDoneImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The ID of the response.
  @JsonKey(name: 'response_id')
  String get responseId;

  /// The ID of the item.
  @JsonKey(name: 'item_id')
  String get itemId;

  /// The index of the output item in the response.
  @JsonKey(name: 'output_index')
  int get outputIndex;

  /// The index of the content part in the item's content array.
  @JsonKey(name: 'content_index')
  int get contentIndex;

  /// The final text content.
  String get text;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventResponseTextDoneImplCopyWith<
          _$RealtimeEventResponseTextDoneImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventSessionCreatedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventSessionCreatedImplCopyWith(
          _$RealtimeEventSessionCreatedImpl value,
          $Res Function(_$RealtimeEventSessionCreatedImpl) then) =
      __$$RealtimeEventSessionCreatedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      Session session});

  $SessionCopyWith<$Res> get session;
}

/// @nodoc
class __$$RealtimeEventSessionCreatedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventSessionCreatedImpl>
    implements _$$RealtimeEventSessionCreatedImplCopyWith<$Res> {
  __$$RealtimeEventSessionCreatedImplCopyWithImpl(
      _$RealtimeEventSessionCreatedImpl _value,
      $Res Function(_$RealtimeEventSessionCreatedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? session = null,
  }) {
    return _then(_$RealtimeEventSessionCreatedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      session: null == session
          ? _value.session
          : session // ignore: cast_nullable_to_non_nullable
              as Session,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $SessionCopyWith<$Res> get session {
    return $SessionCopyWith<$Res>(_value.session, (value) {
      return _then(_value.copyWith(session: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventSessionCreatedImpl extends RealtimeEventSessionCreated {
  const _$RealtimeEventSessionCreatedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.sessionCreated,
      required this.session})
      : super._();

  factory _$RealtimeEventSessionCreatedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventSessionCreatedImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The session resource.
  @override
  final Session session;

  @override
  String toString() {
    return 'RealtimeEvent.sessionCreated(eventId: $eventId, type: $type, session: $session)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventSessionCreatedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.session, session) || other.session == session));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, session);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventSessionCreatedImplCopyWith<_$RealtimeEventSessionCreatedImpl>
      get copyWith => __$$RealtimeEventSessionCreatedImplCopyWithImpl<
          _$RealtimeEventSessionCreatedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return sessionCreated(eventId, type, session);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return sessionCreated?.call(eventId, type, session);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (sessionCreated != null) {
      return sessionCreated(eventId, type, session);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return sessionCreated(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return sessionCreated?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (sessionCreated != null) {
      return sessionCreated(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventSessionCreatedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventSessionCreated extends RealtimeEvent {
  const factory RealtimeEventSessionCreated(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      required final Session session}) = _$RealtimeEventSessionCreatedImpl;
  const RealtimeEventSessionCreated._() : super._();

  factory RealtimeEventSessionCreated.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventSessionCreatedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The session resource.
  Session get session;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventSessionCreatedImplCopyWith<_$RealtimeEventSessionCreatedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventSessionUpdatedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventSessionUpdatedImplCopyWith(
          _$RealtimeEventSessionUpdatedImpl value,
          $Res Function(_$RealtimeEventSessionUpdatedImpl) then) =
      __$$RealtimeEventSessionUpdatedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      Session session});

  $SessionCopyWith<$Res> get session;
}

/// @nodoc
class __$$RealtimeEventSessionUpdatedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventSessionUpdatedImpl>
    implements _$$RealtimeEventSessionUpdatedImplCopyWith<$Res> {
  __$$RealtimeEventSessionUpdatedImplCopyWithImpl(
      _$RealtimeEventSessionUpdatedImpl _value,
      $Res Function(_$RealtimeEventSessionUpdatedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? session = null,
  }) {
    return _then(_$RealtimeEventSessionUpdatedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      session: null == session
          ? _value.session
          : session // ignore: cast_nullable_to_non_nullable
              as Session,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $SessionCopyWith<$Res> get session {
    return $SessionCopyWith<$Res>(_value.session, (value) {
      return _then(_value.copyWith(session: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventSessionUpdatedImpl extends RealtimeEventSessionUpdated {
  const _$RealtimeEventSessionUpdatedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.sessionUpdated,
      required this.session})
      : super._();

  factory _$RealtimeEventSessionUpdatedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventSessionUpdatedImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// The session resource.
  @override
  final Session session;

  @override
  String toString() {
    return 'RealtimeEvent.sessionUpdated(eventId: $eventId, type: $type, session: $session)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventSessionUpdatedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.session, session) || other.session == session));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, session);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventSessionUpdatedImplCopyWith<_$RealtimeEventSessionUpdatedImpl>
      get copyWith => __$$RealtimeEventSessionUpdatedImplCopyWithImpl<
          _$RealtimeEventSessionUpdatedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return sessionUpdated(eventId, type, session);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return sessionUpdated?.call(eventId, type, session);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (sessionUpdated != null) {
      return sessionUpdated(eventId, type, session);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return sessionUpdated(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return sessionUpdated?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (sessionUpdated != null) {
      return sessionUpdated(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventSessionUpdatedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventSessionUpdated extends RealtimeEvent {
  const factory RealtimeEventSessionUpdated(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      required final Session session}) = _$RealtimeEventSessionUpdatedImpl;
  const RealtimeEventSessionUpdated._() : super._();

  factory RealtimeEventSessionUpdated.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventSessionUpdatedImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// The session resource.
  Session get session;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventSessionUpdatedImplCopyWith<_$RealtimeEventSessionUpdatedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventCloseImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventCloseImplCopyWith(_$RealtimeEventCloseImpl value,
          $Res Function(_$RealtimeEventCloseImpl) then) =
      __$$RealtimeEventCloseImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      bool error});
}

/// @nodoc
class __$$RealtimeEventCloseImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventCloseImpl>
    implements _$$RealtimeEventCloseImplCopyWith<$Res> {
  __$$RealtimeEventCloseImplCopyWithImpl(_$RealtimeEventCloseImpl _value,
      $Res Function(_$RealtimeEventCloseImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? error = null,
  }) {
    return _then(_$RealtimeEventCloseImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      error: null == error
          ? _value.error
          : error // ignore: cast_nullable_to_non_nullable
              as bool,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventCloseImpl extends RealtimeEventClose {
  const _$RealtimeEventCloseImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.close,
      required this.error})
      : super._();

  factory _$RealtimeEventCloseImpl.fromJson(Map<String, dynamic> json) =>
      _$$RealtimeEventCloseImplFromJson(json);

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// Whether the close was due to an error.
  @override
  final bool error;

  @override
  String toString() {
    return 'RealtimeEvent.close(eventId: $eventId, type: $type, error: $error)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventCloseImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.error, error) || other.error == error));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, error);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventCloseImplCopyWith<_$RealtimeEventCloseImpl> get copyWith =>
      __$$RealtimeEventCloseImplCopyWithImpl<_$RealtimeEventCloseImpl>(
          this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return close(eventId, type, this.error);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return close?.call(eventId, type, this.error);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (close != null) {
      return close(eventId, type, this.error);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return close(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return close?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (close != null) {
      return close(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventCloseImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventClose extends RealtimeEvent {
  const factory RealtimeEventClose(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      required final bool error}) = _$RealtimeEventCloseImpl;
  const RealtimeEventClose._() : super._();

  factory RealtimeEventClose.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventCloseImpl.fromJson;

  /// The unique ID of the server event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// Whether the close was due to an error.
  bool get error;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventCloseImplCopyWith<_$RealtimeEventCloseImpl> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventConversationInterruptedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventConversationInterruptedImplCopyWith(
          _$RealtimeEventConversationInterruptedImpl value,
          $Res Function(_$RealtimeEventConversationInterruptedImpl) then) =
      __$$RealtimeEventConversationInterruptedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId, RealtimeEventType type});
}

/// @nodoc
class __$$RealtimeEventConversationInterruptedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventConversationInterruptedImpl>
    implements _$$RealtimeEventConversationInterruptedImplCopyWith<$Res> {
  __$$RealtimeEventConversationInterruptedImplCopyWithImpl(
      _$RealtimeEventConversationInterruptedImpl _value,
      $Res Function(_$RealtimeEventConversationInterruptedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
  }) {
    return _then(_$RealtimeEventConversationInterruptedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
    ));
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventConversationInterruptedImpl
    extends RealtimeEventConversationInterrupted {
  const _$RealtimeEventConversationInterruptedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.conversationInterrupted})
      : super._();

  factory _$RealtimeEventConversationInterruptedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventConversationInterruptedImplFromJson(json);

  /// The unique ID of the event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  @override
  String toString() {
    return 'RealtimeEvent.conversationInterrupted(eventId: $eventId, type: $type)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventConversationInterruptedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventConversationInterruptedImplCopyWith<
          _$RealtimeEventConversationInterruptedImpl>
      get copyWith => __$$RealtimeEventConversationInterruptedImplCopyWithImpl<
          _$RealtimeEventConversationInterruptedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return conversationInterrupted(eventId, type);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return conversationInterrupted?.call(eventId, type);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (conversationInterrupted != null) {
      return conversationInterrupted(eventId, type);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return conversationInterrupted(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return conversationInterrupted?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (conversationInterrupted != null) {
      return conversationInterrupted(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventConversationInterruptedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventConversationInterrupted extends RealtimeEvent {
  const factory RealtimeEventConversationInterrupted(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type}) =
      _$RealtimeEventConversationInterruptedImpl;
  const RealtimeEventConversationInterrupted._() : super._();

  factory RealtimeEventConversationInterrupted.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventConversationInterruptedImpl.fromJson;

  /// The unique ID of the event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventConversationInterruptedImplCopyWith<
          _$RealtimeEventConversationInterruptedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventConversationUpdatedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventConversationUpdatedImplCopyWith(
          _$RealtimeEventConversationUpdatedImpl value,
          $Res Function(_$RealtimeEventConversationUpdatedImpl) then) =
      __$$RealtimeEventConversationUpdatedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      EventHandlerResult result});

  $EventHandlerResultCopyWith<$Res> get result;
}

/// @nodoc
class __$$RealtimeEventConversationUpdatedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventConversationUpdatedImpl>
    implements _$$RealtimeEventConversationUpdatedImplCopyWith<$Res> {
  __$$RealtimeEventConversationUpdatedImplCopyWithImpl(
      _$RealtimeEventConversationUpdatedImpl _value,
      $Res Function(_$RealtimeEventConversationUpdatedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? result = null,
  }) {
    return _then(_$RealtimeEventConversationUpdatedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      result: null == result
          ? _value.result
          : result // ignore: cast_nullable_to_non_nullable
              as EventHandlerResult,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $EventHandlerResultCopyWith<$Res> get result {
    return $EventHandlerResultCopyWith<$Res>(_value.result, (value) {
      return _then(_value.copyWith(result: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventConversationUpdatedImpl
    extends RealtimeEventConversationUpdated {
  const _$RealtimeEventConversationUpdatedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.conversationUpdated,
      required this.result})
      : super._();

  factory _$RealtimeEventConversationUpdatedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventConversationUpdatedImplFromJson(json);

  /// The unique ID of the event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// No Description
  @override
  final EventHandlerResult result;

  @override
  String toString() {
    return 'RealtimeEvent.conversationUpdated(eventId: $eventId, type: $type, result: $result)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventConversationUpdatedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.result, result) || other.result == result));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, result);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventConversationUpdatedImplCopyWith<
          _$RealtimeEventConversationUpdatedImpl>
      get copyWith => __$$RealtimeEventConversationUpdatedImplCopyWithImpl<
          _$RealtimeEventConversationUpdatedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return conversationUpdated(eventId, type, result);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return conversationUpdated?.call(eventId, type, result);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (conversationUpdated != null) {
      return conversationUpdated(eventId, type, result);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return conversationUpdated(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return conversationUpdated?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (conversationUpdated != null) {
      return conversationUpdated(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventConversationUpdatedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventConversationUpdated extends RealtimeEvent {
  const factory RealtimeEventConversationUpdated(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          required final EventHandlerResult result}) =
      _$RealtimeEventConversationUpdatedImpl;
  const RealtimeEventConversationUpdated._() : super._();

  factory RealtimeEventConversationUpdated.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventConversationUpdatedImpl.fromJson;

  /// The unique ID of the event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// No Description
  EventHandlerResult get result;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventConversationUpdatedImplCopyWith<
          _$RealtimeEventConversationUpdatedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventConversationItemAppendedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventConversationItemAppendedImplCopyWith(
          _$RealtimeEventConversationItemAppendedImpl value,
          $Res Function(_$RealtimeEventConversationItemAppendedImpl) then) =
      __$$RealtimeEventConversationItemAppendedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      FormattedItem item});

  $FormattedItemCopyWith<$Res> get item;
}

/// @nodoc
class __$$RealtimeEventConversationItemAppendedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventConversationItemAppendedImpl>
    implements _$$RealtimeEventConversationItemAppendedImplCopyWith<$Res> {
  __$$RealtimeEventConversationItemAppendedImplCopyWithImpl(
      _$RealtimeEventConversationItemAppendedImpl _value,
      $Res Function(_$RealtimeEventConversationItemAppendedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? item = null,
  }) {
    return _then(_$RealtimeEventConversationItemAppendedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      item: null == item
          ? _value.item
          : item // ignore: cast_nullable_to_non_nullable
              as FormattedItem,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $FormattedItemCopyWith<$Res> get item {
    return $FormattedItemCopyWith<$Res>(_value.item, (value) {
      return _then(_value.copyWith(item: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventConversationItemAppendedImpl
    extends RealtimeEventConversationItemAppended {
  const _$RealtimeEventConversationItemAppendedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.conversationItemAppended,
      required this.item})
      : super._();

  factory _$RealtimeEventConversationItemAppendedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventConversationItemAppendedImplFromJson(json);

  /// The unique ID of the event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// A formatted item.
  @override
  final FormattedItem item;

  @override
  String toString() {
    return 'RealtimeEvent.conversationItemAppended(eventId: $eventId, type: $type, item: $item)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventConversationItemAppendedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.item, item) || other.item == item));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, item);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventConversationItemAppendedImplCopyWith<
          _$RealtimeEventConversationItemAppendedImpl>
      get copyWith => __$$RealtimeEventConversationItemAppendedImplCopyWithImpl<
          _$RealtimeEventConversationItemAppendedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return conversationItemAppended(eventId, type, item);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return conversationItemAppended?.call(eventId, type, item);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (conversationItemAppended != null) {
      return conversationItemAppended(eventId, type, item);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return conversationItemAppended(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return conversationItemAppended?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (conversationItemAppended != null) {
      return conversationItemAppended(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventConversationItemAppendedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventConversationItemAppended extends RealtimeEvent {
  const factory RealtimeEventConversationItemAppended(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          required final FormattedItem item}) =
      _$RealtimeEventConversationItemAppendedImpl;
  const RealtimeEventConversationItemAppended._() : super._();

  factory RealtimeEventConversationItemAppended.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventConversationItemAppendedImpl.fromJson;

  /// The unique ID of the event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// A formatted item.
  FormattedItem get item;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventConversationItemAppendedImplCopyWith<
          _$RealtimeEventConversationItemAppendedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventConversationItemCompletedImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventConversationItemCompletedImplCopyWith(
          _$RealtimeEventConversationItemCompletedImpl value,
          $Res Function(_$RealtimeEventConversationItemCompletedImpl) then) =
      __$$RealtimeEventConversationItemCompletedImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      FormattedItem item});

  $FormattedItemCopyWith<$Res> get item;
}

/// @nodoc
class __$$RealtimeEventConversationItemCompletedImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res,
        _$RealtimeEventConversationItemCompletedImpl>
    implements _$$RealtimeEventConversationItemCompletedImplCopyWith<$Res> {
  __$$RealtimeEventConversationItemCompletedImplCopyWithImpl(
      _$RealtimeEventConversationItemCompletedImpl _value,
      $Res Function(_$RealtimeEventConversationItemCompletedImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? item = null,
  }) {
    return _then(_$RealtimeEventConversationItemCompletedImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      item: null == item
          ? _value.item
          : item // ignore: cast_nullable_to_non_nullable
              as FormattedItem,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $FormattedItemCopyWith<$Res> get item {
    return $FormattedItemCopyWith<$Res>(_value.item, (value) {
      return _then(_value.copyWith(item: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventConversationItemCompletedImpl
    extends RealtimeEventConversationItemCompleted {
  const _$RealtimeEventConversationItemCompletedImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.conversationItemCompleted,
      required this.item})
      : super._();

  factory _$RealtimeEventConversationItemCompletedImpl.fromJson(
          Map<String, dynamic> json) =>
      _$$RealtimeEventConversationItemCompletedImplFromJson(json);

  /// The unique ID of the event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// A formatted item.
  @override
  final FormattedItem item;

  @override
  String toString() {
    return 'RealtimeEvent.conversationItemCompleted(eventId: $eventId, type: $type, item: $item)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventConversationItemCompletedImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.item, item) || other.item == item));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, item);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventConversationItemCompletedImplCopyWith<
          _$RealtimeEventConversationItemCompletedImpl>
      get copyWith =>
          __$$RealtimeEventConversationItemCompletedImplCopyWithImpl<
              _$RealtimeEventConversationItemCompletedImpl>(this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return conversationItemCompleted(eventId, type, item);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return conversationItemCompleted?.call(eventId, type, item);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (conversationItemCompleted != null) {
      return conversationItemCompleted(eventId, type, item);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return conversationItemCompleted(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return conversationItemCompleted?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (conversationItemCompleted != null) {
      return conversationItemCompleted(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventConversationItemCompletedImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventConversationItemCompleted extends RealtimeEvent {
  const factory RealtimeEventConversationItemCompleted(
          {@JsonKey(name: 'event_id') required final String eventId,
          final RealtimeEventType type,
          required final FormattedItem item}) =
      _$RealtimeEventConversationItemCompletedImpl;
  const RealtimeEventConversationItemCompleted._() : super._();

  factory RealtimeEventConversationItemCompleted.fromJson(
          Map<String, dynamic> json) =
      _$RealtimeEventConversationItemCompletedImpl.fromJson;

  /// The unique ID of the event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// A formatted item.
  FormattedItem get item;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventConversationItemCompletedImplCopyWith<
          _$RealtimeEventConversationItemCompletedImpl>
      get copyWith => throw _privateConstructorUsedError;
}

/// @nodoc
abstract class _$$RealtimeEventGenericImplCopyWith<$Res>
    implements $RealtimeEventCopyWith<$Res> {
  factory _$$RealtimeEventGenericImplCopyWith(_$RealtimeEventGenericImpl value,
          $Res Function(_$RealtimeEventGenericImpl) then) =
      __$$RealtimeEventGenericImplCopyWithImpl<$Res>;
  @override
  @useResult
  $Res call(
      {@JsonKey(name: 'event_id') String eventId,
      RealtimeEventType type,
      RealtimeEvent event});

  $RealtimeEventCopyWith<$Res> get event;
}

/// @nodoc
class __$$RealtimeEventGenericImplCopyWithImpl<$Res>
    extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventGenericImpl>
    implements _$$RealtimeEventGenericImplCopyWith<$Res> {
  __$$RealtimeEventGenericImplCopyWithImpl(_$RealtimeEventGenericImpl _value,
      $Res Function(_$RealtimeEventGenericImpl) _then)
      : super(_value, _then);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? eventId = null,
    Object? type = null,
    Object? event = null,
  }) {
    return _then(_$RealtimeEventGenericImpl(
      eventId: null == eventId
          ? _value.eventId
          : eventId // ignore: cast_nullable_to_non_nullable
              as String,
      type: null == type
          ? _value.type
          : type // ignore: cast_nullable_to_non_nullable
              as RealtimeEventType,
      event: null == event
          ? _value.event
          : event // ignore: cast_nullable_to_non_nullable
              as RealtimeEvent,
    ));
  }

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @pragma('vm:prefer-inline')
  $RealtimeEventCopyWith<$Res> get event {
    return $RealtimeEventCopyWith<$Res>(_value.event, (value) {
      return _then(_value.copyWith(event: value));
    });
  }
}

/// @nodoc
@JsonSerializable()
class _$RealtimeEventGenericImpl extends RealtimeEventGeneric {
  const _$RealtimeEventGenericImpl(
      {@JsonKey(name: 'event_id') required this.eventId,
      this.type = RealtimeEventType.realtimeEvent,
      required this.event})
      : super._();

  factory _$RealtimeEventGenericImpl.fromJson(Map<String, dynamic> json) =>
      _$$RealtimeEventGenericImplFromJson(json);

  /// The unique ID of the event.
  @override
  @JsonKey(name: 'event_id')
  final String eventId;

  /// The type of the event.
  @override
  @JsonKey()
  final RealtimeEventType type;

  /// A Realtime API event.
  /// Any of: [RealtimeEventConversationItemCreate], [RealtimeEventConversationItemDelete], [RealtimeEventConversationItemTruncate], [RealtimeEventInputAudioBufferAppend], [RealtimeEventInputAudioBufferClear], [RealtimeEventInputAudioBufferCommit], [RealtimeEventResponseCancel], [RealtimeEventResponseCreate], [RealtimeEventSessionUpdate], [RealtimeEventConversationCreated], [RealtimeEventConversationItemCreated], [RealtimeEventConversationItemDeleted], [RealtimeEventConversationItemInputAudioTranscriptionCompleted], [RealtimeEventConversationItemInputAudioTranscriptionFailed], [RealtimeEventConversationItemTruncated], [RealtimeEventError], [RealtimeEventInputAudioBufferCleared], [RealtimeEventInputAudioBufferCommitted], [RealtimeEventInputAudioBufferSpeechStarted], [RealtimeEventInputAudioBufferSpeechStopped], [RealtimeEventRateLimitsUpdated], [RealtimeEventResponseAudioDelta], [RealtimeEventResponseAudioDone], [RealtimeEventResponseAudioTranscriptDelta], [RealtimeEventResponseAudioTranscriptDone], [RealtimeEventResponseContentPartAdded], [RealtimeEventResponseContentPartDone], [RealtimeEventResponseCreated], [RealtimeEventResponseDone], [RealtimeEventResponseFunctionCallArgumentsDelta], [RealtimeEventResponseFunctionCallArgumentsDone], [RealtimeEventResponseOutputItemAdded], [RealtimeEventResponseOutputItemDone], [RealtimeEventResponseTextDelta], [RealtimeEventResponseTextDone], [RealtimeEventSessionCreated], [RealtimeEventSessionUpdated], [RealtimeEventClose], [RealtimeEventConversationInterrupted], [RealtimeEventConversationUpdated], [RealtimeEventConversationItemAppended], [RealtimeEventConversationItemCompleted], [RealtimeEventGeneric]
  @override
  final RealtimeEvent event;

  @override
  String toString() {
    return 'RealtimeEvent.generic(eventId: $eventId, type: $type, event: $event)';
  }

  @override
  bool operator ==(Object other) {
    return identical(this, other) ||
        (other.runtimeType == runtimeType &&
            other is _$RealtimeEventGenericImpl &&
            (identical(other.eventId, eventId) || other.eventId == eventId) &&
            (identical(other.type, type) || other.type == type) &&
            (identical(other.event, event) || other.event == event));
  }

  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  int get hashCode => Object.hash(runtimeType, eventId, type, event);

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  @override
  @pragma('vm:prefer-inline')
  _$$RealtimeEventGenericImplCopyWith<_$RealtimeEventGenericImpl>
      get copyWith =>
          __$$RealtimeEventGenericImplCopyWithImpl<_$RealtimeEventGenericImpl>(
              this, _$identity);

  @override
  @optionalTypeArgs
  TResult when<TResult extends Object?>({
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)
        conversationItemCreate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDelete,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)
        inputAudioBufferAppend,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferClear,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCommit,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        responseCancel,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)
        responseCreate,
    required TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)
        sessionUpdate,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)
        conversationCreated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)
        conversationItemCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)
        conversationItemDeleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)
        conversationItemTruncated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)
        error,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        inputAudioBufferCleared,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferCommitted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStarted,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)
        inputAudioBufferSpeechStopped,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)
        rateLimitsUpdated,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)
        responseAudioDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseAudioTranscriptDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)
        responseAudioTranscriptDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)
        responseContentPartDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)
        responseDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)
        responseFunctionCallArgumentsDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemAdded,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)
        responseOutputItemDone,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)
        responseTextDelta,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)
        responseTextDone,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionCreated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)
        sessionUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)
        close,
    required TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)
        conversationInterrupted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)
        conversationUpdated,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemAppended,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)
        conversationItemCompleted,
    required TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)
        generic,
  }) {
    return generic(eventId, type, event);
  }

  @override
  @optionalTypeArgs
  TResult? whenOrNull<TResult extends Object?>({
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult? Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult? Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult? Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
  }) {
    return generic?.call(eventId, type, event);
  }

  @override
  @optionalTypeArgs
  TResult maybeWhen<TResult extends Object?>({
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id', includeIfNull: false)
            String? previousItemId,
            Item item)?
        conversationItemCreate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDelete,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, String audio)?
        inputAudioBufferAppend,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferClear,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCommit,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        responseCancel,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(includeIfNull: false) ResponseConfig? response)?
        responseCreate,
    TResult Function(
            @JsonKey(name: 'event_id', includeIfNull: false) String? eventId,
            RealtimeEventType type,
            SessionConfig session)?
        sessionUpdate,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Conversation conversation)?
        conversationCreated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String? previousItemId,
            Item item)?
        conversationItemCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)?
        conversationItemDeleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            TranscriptionError error)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'content_index') int contentIndex,
            @JsonKey(name: 'audio_end_ms') int audioEndMs)?
        conversationItemTruncated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, APIError error)?
        error,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        inputAudioBufferCleared,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'previous_item_id') String previousItemId,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferCommitted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_start_ms') int audioStartMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStarted,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'audio_end_ms') int audioEndMs,
            @JsonKey(name: 'item_id') String itemId)?
        inputAudioBufferSpeechStopped,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'rate_limits') List<RateLimit> rateLimits)?
        rateLimitsUpdated,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex)?
        responseAudioDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseAudioTranscriptDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String transcript)?
        responseAudioTranscriptDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            ContentPart part)?
        responseContentPartDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Response response)?
        responseDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String delta)?
        responseFunctionCallArgumentsDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'call_id') String callId,
            String arguments)?
        responseFunctionCallArgumentsDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemAdded,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'output_index') int outputIndex,
            Item item)?
        responseOutputItemDone,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String delta)?
        responseTextDelta,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type,
            @JsonKey(name: 'response_id') String responseId,
            @JsonKey(name: 'item_id') String itemId,
            @JsonKey(name: 'output_index') int outputIndex,
            @JsonKey(name: 'content_index') int contentIndex,
            String text)?
        responseTextDone,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionCreated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, Session session)?
        sessionUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, bool error)?
        close,
    TResult Function(
            @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)?
        conversationInterrupted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, EventHandlerResult result)?
        conversationUpdated,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemAppended,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, FormattedItem item)?
        conversationItemCompleted,
    TResult Function(@JsonKey(name: 'event_id') String eventId,
            RealtimeEventType type, RealtimeEvent event)?
        generic,
    required TResult orElse(),
  }) {
    if (generic != null) {
      return generic(eventId, type, event);
    }
    return orElse();
  }

  @override
  @optionalTypeArgs
  TResult map<TResult extends Object?>({
    required TResult Function(RealtimeEventConversationItemCreate value)
        conversationItemCreate,
    required TResult Function(RealtimeEventConversationItemDelete value)
        conversationItemDelete,
    required TResult Function(RealtimeEventConversationItemTruncate value)
        conversationItemTruncate,
    required TResult Function(RealtimeEventInputAudioBufferAppend value)
        inputAudioBufferAppend,
    required TResult Function(RealtimeEventInputAudioBufferClear value)
        inputAudioBufferClear,
    required TResult Function(RealtimeEventInputAudioBufferCommit value)
        inputAudioBufferCommit,
    required TResult Function(RealtimeEventResponseCancel value) responseCancel,
    required TResult Function(RealtimeEventResponseCreate value) responseCreate,
    required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate,
    required TResult Function(RealtimeEventConversationCreated value)
        conversationCreated,
    required TResult Function(RealtimeEventConversationItemCreated value)
        conversationItemCreated,
    required TResult Function(RealtimeEventConversationItemDeleted value)
        conversationItemDeleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted value)
        conversationItemInputAudioTranscriptionCompleted,
    required TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)
        conversationItemInputAudioTranscriptionFailed,
    required TResult Function(RealtimeEventConversationItemTruncated value)
        conversationItemTruncated,
    required TResult Function(RealtimeEventError value) error,
    required TResult Function(RealtimeEventInputAudioBufferCleared value)
        inputAudioBufferCleared,
    required TResult Function(RealtimeEventInputAudioBufferCommitted value)
        inputAudioBufferCommitted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)
        inputAudioBufferSpeechStarted,
    required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)
        inputAudioBufferSpeechStopped,
    required TResult Function(RealtimeEventRateLimitsUpdated value)
        rateLimitsUpdated,
    required TResult Function(RealtimeEventResponseAudioDelta value)
        responseAudioDelta,
    required TResult Function(RealtimeEventResponseAudioDone value)
        responseAudioDone,
    required TResult Function(RealtimeEventResponseAudioTranscriptDelta value)
        responseAudioTranscriptDelta,
    required TResult Function(RealtimeEventResponseAudioTranscriptDone value)
        responseAudioTranscriptDone,
    required TResult Function(RealtimeEventResponseContentPartAdded value)
        responseContentPartAdded,
    required TResult Function(RealtimeEventResponseContentPartDone value)
        responseContentPartDone,
    required TResult Function(RealtimeEventResponseCreated value)
        responseCreated,
    required TResult Function(RealtimeEventResponseDone value) responseDone,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDelta value)
        responseFunctionCallArgumentsDelta,
    required TResult Function(
            RealtimeEventResponseFunctionCallArgumentsDone value)
        responseFunctionCallArgumentsDone,
    required TResult Function(RealtimeEventResponseOutputItemAdded value)
        responseOutputItemAdded,
    required TResult Function(RealtimeEventResponseOutputItemDone value)
        responseOutputItemDone,
    required TResult Function(RealtimeEventResponseTextDelta value)
        responseTextDelta,
    required TResult Function(RealtimeEventResponseTextDone value)
        responseTextDone,
    required TResult Function(RealtimeEventSessionCreated value) sessionCreated,
    required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated,
    required TResult Function(RealtimeEventClose value) close,
    required TResult Function(RealtimeEventConversationInterrupted value)
        conversationInterrupted,
    required TResult Function(RealtimeEventConversationUpdated value)
        conversationUpdated,
    required TResult Function(RealtimeEventConversationItemAppended value)
        conversationItemAppended,
    required TResult Function(RealtimeEventConversationItemCompleted value)
        conversationItemCompleted,
    required TResult Function(RealtimeEventGeneric value) generic,
  }) {
    return generic(this);
  }

  @override
  @optionalTypeArgs
  TResult? mapOrNull<TResult extends Object?>({
    TResult? Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult? Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult? Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult? Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult? Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult? Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult? Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult? Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult? Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult? Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult? Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult? Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult? Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult? Function(RealtimeEventError value)? error,
    TResult? Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult? Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult? Function(RealtimeEventResponseAudioDelta value)?
        responseAudioDelta,
    TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult? Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult? Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult? Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult? Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult? Function(RealtimeEventResponseDone value)? responseDone,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult? Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult? Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult? Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult? Function(RealtimeEventClose value)? close,
    TResult? Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult? Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult? Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult? Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult? Function(RealtimeEventGeneric value)? generic,
  }) {
    return generic?.call(this);
  }

  @override
  @optionalTypeArgs
  TResult maybeMap<TResult extends Object?>({
    TResult Function(RealtimeEventConversationItemCreate value)?
        conversationItemCreate,
    TResult Function(RealtimeEventConversationItemDelete value)?
        conversationItemDelete,
    TResult Function(RealtimeEventConversationItemTruncate value)?
        conversationItemTruncate,
    TResult Function(RealtimeEventInputAudioBufferAppend value)?
        inputAudioBufferAppend,
    TResult Function(RealtimeEventInputAudioBufferClear value)?
        inputAudioBufferClear,
    TResult Function(RealtimeEventInputAudioBufferCommit value)?
        inputAudioBufferCommit,
    TResult Function(RealtimeEventResponseCancel value)? responseCancel,
    TResult Function(RealtimeEventResponseCreate value)? responseCreate,
    TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate,
    TResult Function(RealtimeEventConversationCreated value)?
        conversationCreated,
    TResult Function(RealtimeEventConversationItemCreated value)?
        conversationItemCreated,
    TResult Function(RealtimeEventConversationItemDeleted value)?
        conversationItemDeleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionCompleted
                value)?
        conversationItemInputAudioTranscriptionCompleted,
    TResult Function(
            RealtimeEventConversationItemInputAudioTranscriptionFailed value)?
        conversationItemInputAudioTranscriptionFailed,
    TResult Function(RealtimeEventConversationItemTruncated value)?
        conversationItemTruncated,
    TResult Function(RealtimeEventError value)? error,
    TResult Function(RealtimeEventInputAudioBufferCleared value)?
        inputAudioBufferCleared,
    TResult Function(RealtimeEventInputAudioBufferCommitted value)?
        inputAudioBufferCommitted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)?
        inputAudioBufferSpeechStarted,
    TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)?
        inputAudioBufferSpeechStopped,
    TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated,
    TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta,
    TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone,
    TResult Function(RealtimeEventResponseAudioTranscriptDelta value)?
        responseAudioTranscriptDelta,
    TResult Function(RealtimeEventResponseAudioTranscriptDone value)?
        responseAudioTranscriptDone,
    TResult Function(RealtimeEventResponseContentPartAdded value)?
        responseContentPartAdded,
    TResult Function(RealtimeEventResponseContentPartDone value)?
        responseContentPartDone,
    TResult Function(RealtimeEventResponseCreated value)? responseCreated,
    TResult Function(RealtimeEventResponseDone value)? responseDone,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)?
        responseFunctionCallArgumentsDelta,
    TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)?
        responseFunctionCallArgumentsDone,
    TResult Function(RealtimeEventResponseOutputItemAdded value)?
        responseOutputItemAdded,
    TResult Function(RealtimeEventResponseOutputItemDone value)?
        responseOutputItemDone,
    TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta,
    TResult Function(RealtimeEventResponseTextDone value)? responseTextDone,
    TResult Function(RealtimeEventSessionCreated value)? sessionCreated,
    TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated,
    TResult Function(RealtimeEventClose value)? close,
    TResult Function(RealtimeEventConversationInterrupted value)?
        conversationInterrupted,
    TResult Function(RealtimeEventConversationUpdated value)?
        conversationUpdated,
    TResult Function(RealtimeEventConversationItemAppended value)?
        conversationItemAppended,
    TResult Function(RealtimeEventConversationItemCompleted value)?
        conversationItemCompleted,
    TResult Function(RealtimeEventGeneric value)? generic,
    required TResult orElse(),
  }) {
    if (generic != null) {
      return generic(this);
    }
    return orElse();
  }

  @override
  Map<String, dynamic> toJson() {
    return _$$RealtimeEventGenericImplToJson(
      this,
    );
  }
}

abstract class RealtimeEventGeneric extends RealtimeEvent {
  const factory RealtimeEventGeneric(
      {@JsonKey(name: 'event_id') required final String eventId,
      final RealtimeEventType type,
      required final RealtimeEvent event}) = _$RealtimeEventGenericImpl;
  const RealtimeEventGeneric._() : super._();

  factory RealtimeEventGeneric.fromJson(Map<String, dynamic> json) =
      _$RealtimeEventGenericImpl.fromJson;

  /// The unique ID of the event.
  @override
  @JsonKey(name: 'event_id')
  String get eventId;

  /// The type of the event.
  @override
  RealtimeEventType get type;

  /// A Realtime API event.
  /// Any of: [RealtimeEventConversationItemCreate], [RealtimeEventConversationItemDelete], [RealtimeEventConversationItemTruncate], [RealtimeEventInputAudioBufferAppend], [RealtimeEventInputAudioBufferClear], [RealtimeEventInputAudioBufferCommit], [RealtimeEventResponseCancel], [RealtimeEventResponseCreate], [RealtimeEventSessionUpdate], [RealtimeEventConversationCreated], [RealtimeEventConversationItemCreated], [RealtimeEventConversationItemDeleted], [RealtimeEventConversationItemInputAudioTranscriptionCompleted], [RealtimeEventConversationItemInputAudioTranscriptionFailed], [RealtimeEventConversationItemTruncated], [RealtimeEventError], [RealtimeEventInputAudioBufferCleared], [RealtimeEventInputAudioBufferCommitted], [RealtimeEventInputAudioBufferSpeechStarted], [RealtimeEventInputAudioBufferSpeechStopped], [RealtimeEventRateLimitsUpdated], [RealtimeEventResponseAudioDelta], [RealtimeEventResponseAudioDone], [RealtimeEventResponseAudioTranscriptDelta], [RealtimeEventResponseAudioTranscriptDone], [RealtimeEventResponseContentPartAdded], [RealtimeEventResponseContentPartDone], [RealtimeEventResponseCreated], [RealtimeEventResponseDone], [RealtimeEventResponseFunctionCallArgumentsDelta], [RealtimeEventResponseFunctionCallArgumentsDone], [RealtimeEventResponseOutputItemAdded], [RealtimeEventResponseOutputItemDone], [RealtimeEventResponseTextDelta], [RealtimeEventResponseTextDone], [RealtimeEventSessionCreated], [RealtimeEventSessionUpdated], [RealtimeEventClose], [RealtimeEventConversationInterrupted], [RealtimeEventConversationUpdated], [RealtimeEventConversationItemAppended], [RealtimeEventConversationItemCompleted], [RealtimeEventGeneric]
  RealtimeEvent get event;

  /// Create a copy of RealtimeEvent
  /// with the given fields replaced by the non-null parameter values.
  @override
  @JsonKey(includeFromJson: false, includeToJson: false)
  _$$RealtimeEventGenericImplCopyWith<_$RealtimeEventGenericImpl>
      get copyWith => throw _privateConstructorUsedError;
}
