// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'ag_ui_event.dart';

// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************

AgUiEvent _$AgUiEventFromJson(Map<String, dynamic> json) =>
    AgUiEvent(type: $enumDecode(_$AgUiEventTypeEnumMap, json['type']));

Map<String, dynamic> _$AgUiEventToJson(AgUiEvent instance) => <String, dynamic>{
  'type': _$AgUiEventTypeEnumMap[instance.type]!,
};

const _$AgUiEventTypeEnumMap = {
  AgUiEventType.runStarted: 'runStarted',
  AgUiEventType.runFinished: 'runFinished',
  AgUiEventType.runError: 'runError',
  AgUiEventType.textMessageStart: 'textMessageStart',
  AgUiEventType.textMessageContent: 'textMessageContent',
  AgUiEventType.textMessageEnd: 'textMessageEnd',
  AgUiEventType.toolCallStart: 'toolCallStart',
  AgUiEventType.toolCallArgs: 'toolCallArgs',
  AgUiEventType.toolCallEnd: 'toolCallEnd',
  AgUiEventType.toolCallResult: 'toolCallResult',
  AgUiEventType.toolCallError: 'toolCallError',
  AgUiEventType.messagesSnapshot: 'messagesSnapshot',
  AgUiEventType.unknown: 'unknown',
};

UnknownAgUiEvent _$UnknownAgUiEventFromJson(Map<String, dynamic> json) =>
    UnknownAgUiEvent(rawJson: json['rawJson'] as Map<String, dynamic>);

Map<String, dynamic> _$UnknownAgUiEventToJson(UnknownAgUiEvent instance) =>
    <String, dynamic>{'rawJson': instance.rawJson};

RunStartedEvent _$RunStartedEventFromJson(Map<String, dynamic> json) =>
    RunStartedEvent(
      threadId: json['threadId'] as String,
      runId: json['runId'] as String,
    );

Map<String, dynamic> _$RunStartedEventToJson(RunStartedEvent instance) =>
    <String, dynamic>{'threadId': instance.threadId, 'runId': instance.runId};

RunFinishedEvent _$RunFinishedEventFromJson(Map<String, dynamic> json) =>
    RunFinishedEvent(
      threadId: json['threadId'] as String,
      runId: json['runId'] as String,
    );

Map<String, dynamic> _$RunFinishedEventToJson(RunFinishedEvent instance) =>
    <String, dynamic>{'threadId': instance.threadId, 'runId': instance.runId};

RunErrorEvent _$RunErrorEventFromJson(Map<String, dynamic> json) =>
    RunErrorEvent(
      message: json['message'] as String,
      code: json['code'] as String?,
    );

Map<String, dynamic> _$RunErrorEventToJson(RunErrorEvent instance) =>
    <String, dynamic>{'message': instance.message, 'code': instance.code};

TextMessageStartEvent _$TextMessageStartEventFromJson(
  Map<String, dynamic> json,
) => TextMessageStartEvent(
  messageId: json['messageId'] as String,
  role: json['role'] as String,
);

Map<String, dynamic> _$TextMessageStartEventToJson(
  TextMessageStartEvent instance,
) => <String, dynamic>{'messageId': instance.messageId, 'role': instance.role};

TextMessageContentEvent _$TextMessageContentEventFromJson(
  Map<String, dynamic> json,
) => TextMessageContentEvent(
  messageId: json['messageId'] as String,
  delta: json['delta'] as String,
);

Map<String, dynamic> _$TextMessageContentEventToJson(
  TextMessageContentEvent instance,
) => <String, dynamic>{
  'messageId': instance.messageId,
  'delta': instance.delta,
};

TextMessageEndEvent _$TextMessageEndEventFromJson(Map<String, dynamic> json) =>
    TextMessageEndEvent(messageId: json['messageId'] as String);

Map<String, dynamic> _$TextMessageEndEventToJson(
  TextMessageEndEvent instance,
) => <String, dynamic>{'messageId': instance.messageId};

ToolCallStartEvent _$ToolCallStartEventFromJson(Map<String, dynamic> json) =>
    ToolCallStartEvent(
      toolCallId: json['toolCallId'] as String,
      toolCallName: json['toolCallName'] as String,
      parentMessageId: json['parentMessageId'] as String?,
    );

Map<String, dynamic> _$ToolCallStartEventToJson(ToolCallStartEvent instance) =>
    <String, dynamic>{
      'toolCallId': instance.toolCallId,
      'toolCallName': instance.toolCallName,
      'parentMessageId': instance.parentMessageId,
    };

ToolCallArgsEvent _$ToolCallArgsEventFromJson(Map<String, dynamic> json) =>
    ToolCallArgsEvent(
      toolCallId: json['toolCallId'] as String,
      delta: json['delta'] as String,
    );

Map<String, dynamic> _$ToolCallArgsEventToJson(ToolCallArgsEvent instance) =>
    <String, dynamic>{
      'toolCallId': instance.toolCallId,
      'delta': instance.delta,
    };

ToolCallEndEvent _$ToolCallEndEventFromJson(Map<String, dynamic> json) =>
    ToolCallEndEvent(toolCallId: json['toolCallId'] as String);

Map<String, dynamic> _$ToolCallEndEventToJson(ToolCallEndEvent instance) =>
    <String, dynamic>{'toolCallId': instance.toolCallId};

ToolCallResultEvent _$ToolCallResultEventFromJson(Map<String, dynamic> json) =>
    ToolCallResultEvent(
      messageId: json['messageId'] as String,
      toolCallId: json['toolCallId'] as String,
      result: json['result'] as Map<String, dynamic>,
      ui: json['ui'] == null
          ? null
          : UiCard.fromJson(json['ui'] as Map<String, dynamic>),
    );

Map<String, dynamic> _$ToolCallResultEventToJson(
  ToolCallResultEvent instance,
) => <String, dynamic>{
  'messageId': instance.messageId,
  'toolCallId': instance.toolCallId,
  'result': instance.result,
  'ui': instance.ui,
};

ToolCallErrorEvent _$ToolCallErrorEventFromJson(Map<String, dynamic> json) =>
    ToolCallErrorEvent(
      toolCallId: json['toolCallId'] as String,
      error: json['error'] as String,
      code: json['code'] as String?,
    );

Map<String, dynamic> _$ToolCallErrorEventToJson(ToolCallErrorEvent instance) =>
    <String, dynamic>{
      'toolCallId': instance.toolCallId,
      'error': instance.error,
      'code': instance.code,
    };

MessagesSnapshotEvent _$MessagesSnapshotEventFromJson(
  Map<String, dynamic> json,
) => MessagesSnapshotEvent(
  messages: (json['messages'] as List<dynamic>)
      .map((e) => SnapshotMessage.fromJson(e as Map<String, dynamic>))
      .toList(),
);

Map<String, dynamic> _$MessagesSnapshotEventToJson(
  MessagesSnapshotEvent instance,
) => <String, dynamic>{'messages': instance.messages};

SnapshotMessage _$SnapshotMessageFromJson(Map<String, dynamic> json) =>
    SnapshotMessage(
      id: json['id'] as String,
      role: json['role'] as String,
      content: json['content'] as String?,
      toolCallId: json['toolCallId'] as String?,
      ui: json['ui'] == null
          ? null
          : UiCard.fromJson(json['ui'] as Map<String, dynamic>),
      timestamp: json['timestamp'] == null
          ? null
          : DateTime.parse(json['timestamp'] as String),
    );

Map<String, dynamic> _$SnapshotMessageToJson(SnapshotMessage instance) =>
    <String, dynamic>{
      'id': instance.id,
      'role': instance.role,
      'content': instance.content,
      'toolCallId': instance.toolCallId,
      'ui': instance.ui,
      'timestamp': instance.timestamp?.toIso8601String(),
    };
