import 'TesoBusinessDetail.dart'; class ProximityCoupon { String couponId; TesoBusinessDetail business; String targetName; String targetID; String targetImage; double targetCost; String tagretDescription; String type; int quantity; DateTime expiration; double lowerLimit; double upperLimit; String state; String condition; ProximityCoupon({ this.business, this.couponId, this.expiration, this.targetCost, this.quantity, this.state, this.targetID, this.targetImage, this.targetName, this.tagretDescription, this.lowerLimit, this.upperLimit, this.type, this.condition, }); factory ProximityCoupon.fromJSON(Map json) { return ProximityCoupon( business: TesoBusinessDetail.fromJSON(json['business']), couponId: json['couponId'], targetID: json['targetID'], expiration: DateTime.parse(json['expiration']), targetCost: double.parse((json['targetCost']).toString()), targetName: json['targetName'], targetImage: json['targetImage'], tagretDescription: json['targetDescription'], lowerLimit: double.parse((json['lowerLimit']).toString()), upperLimit: double.parse((json['upperLimit']).toString()), quantity: int.parse(json['quantity'].toString()), state: json['state'], type: json['type'], condition: json['condition']); } Map toJson() { final Map data = Map(); data['business'] = this.business; data['couponId'] = this.couponId; data['target'] = this.targetID; data['targetID'] = this.targetID; data['targetName'] = this.targetName; data['targetCost'] = this.targetCost; data['targetImage'] = this.targetImage; data['targetDescription'] = this.tagretDescription; data['lowerLimit'] = this.lowerLimit; data['upperLimit'] = this.upperLimit; data['expiration'] = this.expiration; data['quantity'] = this.quantity; data['state'] = this.state; data['type'] = this.type; data['condition'] = this.condition; return data; } @override String toString() { return '{"businessId": "$business", "couponId": "$couponId", "targetID": "$targetID", "couponId": "$couponId", "expiration": "$expiration"' + '"quantity": "$quantity", "state": "$state", "type": "$type", "lowerLimit":"$lowerLimit","upperLimit":"$upperLimit","targetName":"$targetName",' + '"targetImage":"$targetImage","targetCost":"$targetCost","targetDescription":"$tagretDescription","condition":"$condition"}'; } }