118 lines
3.4 KiB
Dart
118 lines
3.4 KiB
Dart
/// Status and credit-request payload for the play-money test wallet.
|
|
library;
|
|
|
|
class TestPredictionLimitModel {
|
|
const TestPredictionLimitModel({
|
|
required this.enabled,
|
|
required this.maxPerWindow,
|
|
required this.windowHours,
|
|
required this.usedInWindow,
|
|
required this.remaining,
|
|
required this.canPredict,
|
|
this.resetsAt,
|
|
this.reason,
|
|
});
|
|
|
|
final bool enabled;
|
|
final int maxPerWindow;
|
|
final int windowHours;
|
|
final int usedInWindow;
|
|
final int remaining;
|
|
final bool canPredict;
|
|
final String? resetsAt;
|
|
final String? reason;
|
|
|
|
factory TestPredictionLimitModel.fromJson(Map<String, dynamic>? json) {
|
|
if (json == null) {
|
|
return const TestPredictionLimitModel(
|
|
enabled: false,
|
|
maxPerWindow: 0,
|
|
windowHours: 24,
|
|
usedInWindow: 0,
|
|
remaining: 0,
|
|
canPredict: true,
|
|
);
|
|
}
|
|
return TestPredictionLimitModel(
|
|
enabled: json['enabled'] == true,
|
|
maxPerWindow: (json['maxPerWindow'] as num?)?.toInt() ?? 0,
|
|
windowHours: (json['windowHours'] as num?)?.toInt() ?? 24,
|
|
usedInWindow: (json['usedInWindow'] as num?)?.toInt() ?? 0,
|
|
remaining: (json['remaining'] as num?)?.toInt() ?? 0,
|
|
canPredict: json['canPredict'] != false,
|
|
resetsAt: json['resetsAt'] as String?,
|
|
reason: json['reason'] as String?,
|
|
);
|
|
}
|
|
}
|
|
|
|
class TestWalletStatusModel {
|
|
const TestWalletStatusModel({
|
|
required this.enabled,
|
|
required this.balanceRaw,
|
|
required this.walletTypeId,
|
|
this.walletCode,
|
|
required this.decimals,
|
|
required this.creditAmountRaw,
|
|
required this.maxRequests,
|
|
required this.requestsUsed,
|
|
required this.canRequest,
|
|
this.reason,
|
|
this.cooldownEndsAt,
|
|
this.predictionLimit,
|
|
});
|
|
|
|
final bool enabled;
|
|
final String balanceRaw;
|
|
final int walletTypeId;
|
|
final String? walletCode;
|
|
final int decimals;
|
|
final String creditAmountRaw;
|
|
final int maxRequests;
|
|
final int requestsUsed;
|
|
final bool canRequest;
|
|
final String? reason;
|
|
final String? cooldownEndsAt;
|
|
final TestPredictionLimitModel? predictionLimit;
|
|
|
|
factory TestWalletStatusModel.fromJson(Map<String, dynamic> json) {
|
|
final limitRaw = json['predictionLimit'];
|
|
return TestWalletStatusModel(
|
|
enabled: json['enabled'] == true,
|
|
balanceRaw: (json['balanceRaw'] ?? '0').toString(),
|
|
walletTypeId: (json['walletTypeId'] as num?)?.toInt() ?? 0,
|
|
walletCode: json['walletCode'] as String?,
|
|
decimals: (json['decimals'] as num?)?.toInt() ?? 6,
|
|
creditAmountRaw: (json['creditAmountRaw'] ?? '0').toString(),
|
|
maxRequests: (json['maxRequests'] as num?)?.toInt() ?? 0,
|
|
requestsUsed: (json['requestsUsed'] as num?)?.toInt() ?? 0,
|
|
canRequest: json['canRequest'] == true,
|
|
reason: json['reason'] as String?,
|
|
cooldownEndsAt: json['cooldownEndsAt'] as String?,
|
|
predictionLimit: limitRaw is Map<String, dynamic>
|
|
? TestPredictionLimitModel.fromJson(limitRaw)
|
|
: null,
|
|
);
|
|
}
|
|
}
|
|
|
|
class TestWalletCreditResult {
|
|
const TestWalletCreditResult({
|
|
required this.message,
|
|
required this.amountRaw,
|
|
required this.balanceRaw,
|
|
});
|
|
|
|
final String message;
|
|
final String amountRaw;
|
|
final String balanceRaw;
|
|
|
|
factory TestWalletCreditResult.fromJson(Map<String, dynamic> json) {
|
|
return TestWalletCreditResult(
|
|
message: (json['message'] ?? '').toString(),
|
|
amountRaw: (json['amountRaw'] ?? '0').toString(),
|
|
balanceRaw: (json['balanceRaw'] ?? '0').toString(),
|
|
);
|
|
}
|
|
}
|