toJson method
Base Task fields (no status-specific detail). ttlMs is always
present per the schema (number | null).
Implementation
Map<String, dynamic> toJson() {
final json = <String, dynamic>{
'taskId': taskId,
'status': status.wire,
'createdAt': createdAt,
'lastUpdatedAt': lastUpdatedAt,
'ttlMs': ttlMs,
};
if (statusMessage != null) json['statusMessage'] = statusMessage;
if (pollIntervalMs != null) json['pollIntervalMs'] = pollIntervalMs;
return json;
}