import 'package:json_annotation/json_annotation.dart'; part 'tool_result.g.dart'; /// 工具执行结果(给 AI 的原始数据) @JsonSerializable() class ToolResult { final String? eventId; final bool ok; final String? message; ToolResult({this.eventId, this.ok = true, this.message}); factory ToolResult.fromJson(Map json) => _$ToolResultFromJson(json); Map toJson() => _$ToolResultToJson(this); } /// UI 卡片 Schema(给 UI 渲染) @JsonSerializable() class UiCard { @JsonKey(name: 'type') final String cardType; @JsonKey(name: 'version') final String? schemaVersion; final Map data; final List? actions; UiCard({ required this.cardType, this.schemaVersion = 'v1', required this.data, this.actions, }); factory UiCard.fromJson(Map json) => _$UiCardFromJson(json); Map toJson() => _$UiCardToJson(this); } /// 卡片操作按钮 @JsonSerializable() class CardAction { final String type; final String label; final String? target; final String? action; CardAction({ required this.type, required this.label, this.target, this.action, }); factory CardAction.fromJson(Map json) => _$CardActionFromJson(json); Map toJson() => _$CardActionToJson(this); } /// 日历卡片数据 @JsonSerializable() class CalendarCardData { final String id; final String title; final String? description; final String startAt; final String? endAt; final String? timezone; final String? location; final String? color; final String? sourceType; CalendarCardData({ required this.id, required this.title, this.description, required this.startAt, this.endAt, this.timezone, this.location, this.color, this.sourceType, }); factory CalendarCardData.fromJson(Map json) => _$CalendarCardDataFromJson(json); Map toJson() => _$CalendarCardDataToJson(this); }