class ReferralView { PlanInfo planInfo; String code; bool enableApplyCode; bool isFamilyMember; bool hasAppliedCode; int claimedStorage; ReferralView({ required this.planInfo, required this.code, required this.enableApplyCode, required this.isFamilyMember, required this.hasAppliedCode, required this.claimedStorage, }); factory ReferralView.fromJson(Map json) => ReferralView( planInfo: PlanInfo.fromJson(json["planInfo"]), code: json["code"], enableApplyCode: json["enableApplyCode"], isFamilyMember: json["isFamilyMember"], hasAppliedCode: json["hasAppliedCode"], claimedStorage: json["claimedStorage"], ); Map toJson() => { "planInfo": planInfo.toJson(), "code": code, "enableApplyCode": enableApplyCode, "isFamilyMember": isFamilyMember, "hasAppliedCode": hasAppliedCode, "claimedStorage": claimedStorage, }; } class PlanInfo { bool isEnabled; String planType; int storageInGB; int maxClaimableStorageInGB; PlanInfo({ required this.isEnabled, required this.planType, required this.storageInGB, required this.maxClaimableStorageInGB, }); factory PlanInfo.fromJson(Map json) => PlanInfo( isEnabled: json["isEnabled"], planType: json["planType"], storageInGB: json["storageInGB"], maxClaimableStorageInGB: json["maxClaimableStorageInGB"], ); Map toJson() => { "isEnabled": isEnabled, "planType": planType, "storageInGB": storageInGB, "maxClaimableStorageInGB": maxClaimableStorageInGB, }; } class ReferralStat { String planType; int totalCount; int upgradedCount; ReferralStat(this.planType, this.totalCount, this.upgradedCount); factory ReferralStat.fromJson(Map json) { return ReferralStat( json['planType'], json['totalCount'], json['upgradedCount'], ); } Map toJson() { return { 'planType': planType, 'totalCount': totalCount, 'upgradedCount': upgradedCount, }; } } class Bonus { int storage; String type; int validTill; bool isRevoked; Bonus(this.storage, this.type, this.validTill, this.isRevoked); // fromJson factory Bonus.fromJson(Map json) { return Bonus( json['storage'], json['type'], json['validTill'], json['isRevoked'], ); } Map toJson() { return { 'storage': storage, 'type': type, 'validTill': validTill, 'isRevoked': isRevoked, }; } } class BonusDetails { List referralStats; List bonuses; int refCount; int refUpgradeCount; bool hasAppliedCode; BonusDetails({ required this.referralStats, required this.bonuses, required this.refCount, required this.refUpgradeCount, required this.hasAppliedCode, }); factory BonusDetails.fromJson(Map json) => BonusDetails( referralStats: List.from( json["referralStats"].map((x) => ReferralStat.fromJson(x)), ), bonuses: List.from(json["bonuses"].map((x) => Bonus.fromJson(x))), refCount: json["refCount"], refUpgradeCount: json["refUpgradeCount"], hasAppliedCode: json["hasAppliedCode"], ); Map toJson() => { "referralStats": List.from(referralStats.map((x) => x.toJson())), "bonuses": List.from(bonuses.map((x) => x.toJson())), "refCount": refCount, "refUpgradeCount": refUpgradeCount, "hasAppliedCode": hasAppliedCode, }; }