import 'package:json_annotation/json_annotation.dart'; part 'confirmation.g.dart'; @JsonSerializable() class ConfirmationResponse { @JsonKey(name: 'ttl_seconds', defaultValue: 0) final int ttlSeconds; @JsonKey(name: 'cooldown_seconds', defaultValue: 0) final int cooldownSeconds; @JsonKey(defaultValue: '') final String destination; const ConfirmationResponse({ required this.ttlSeconds, required this.cooldownSeconds, required this.destination, }); Duration get cooldownDuration => Duration(seconds: cooldownSeconds); Duration get ttlDuration => Duration(seconds: ttlSeconds); factory ConfirmationResponse.fromJson(Map json) => _$ConfirmationResponseFromJson(json); Map toJson() => _$ConfirmationResponseToJson(this); }