import 'dart:convert'; import 'simple_business.dart'; class TicketFile { int id; String url; String fileName; String fileType; TicketFile.fromJson(Map json) : id = json['id'], url = json['url'], fileName = json['file_name'], fileType = json['file_type']; Map toJson() => { 'id': id, 'url': url, 'file_name': fileName, 'file_type': fileType, }; @override String toString() { return json.encode(this); } } class Issue { int id; String msg; List files; Issue.fromJson(Map json) : id = json['id'], msg = json['msg'], files = (json['files'] as List).map((e) => TicketFile.fromJson(e)).toList(); Map toJson() => { 'id': id, 'msg': msg, 'files': files, }; @override String toString() { return json.encode(this); } } class FollowUp { int id; String msg; String poster; String createdAt; List files; FollowUp.fromJson(Map json) : id = json['id'], msg = json['msg'], poster = json['poster'], createdAt = json['created_at'], files = (json['files'] as List).map((e) => TicketFile.fromJson(e)).toList(); Map toJson() => { 'id': id, 'msg': msg, 'poster': poster, 'created_at': createdAt, 'files': files }; @override String toString() { return json.encode(this); } } class Ticket { int id; Issue issue; Store store; List followUps; bool isClosed; String createdAt; Ticket.fromJson(Map json) : id = json['id'], issue = Issue.fromJson(json['issue']), store = Store.fromJson(json['store']), followUps = (json['follow_ups'] as List).map((e) => FollowUp.fromJson(e)).toList(), isClosed = json['is_closed'], createdAt = json['created_at']; Map toJson() => { 'id': id, 'issue': issue, 'store': store, 'follow_ups': followUps, 'is_closed': isClosed, 'created_at': createdAt, }; @override String toString() { return json.encode(this); } }