import 'dart:convert'; class FleetModel { List? data; FleetModel({this.data}); factory FleetModel.fromJson(Map json) { final dataList = json['data'] as List; final List data = dataList.map((e) => Data.fromJson(e)).toList(); return FleetModel(data: data); } } class Data { String? symbol; Nav? nav; Registration? registration; Fuel? fuel; //Frame? frame; //Reactor? reactor; //Engine? engine; //List? modules; //List? mounts; Cargo? cargo; Data({ this.symbol, this.nav, this.registration, this.fuel, //this.frame, //this.reactor, //this.engine, //this.modules, //this.mounts, this.cargo, }); factory Data.fromJson(Map json) { return Data( symbol: json['symbol'], nav: Nav.fromJson(json['nav']), registration: Registration.fromJson(json['registration']), fuel: Fuel.fromJson(json['fuel']), //frame: Frame.fromJson(json['frame']), //reactor: Reactor.fromJson(json['reactor']), //engine: Engine.fromJson(json['engine']), //modules: List.from(json['modules']?.map((x) => Module.fromJson(x))), //mounts: List.from(json['mounts']?.map((x) => Mount.fromJson(x))), cargo: Cargo.fromJson(json['cargo']), ); } } class Nav { String? systemSymbol; String? waypointSymbol; Route? route; String? status; String? flightMode; Nav({ this.systemSymbol, this.waypointSymbol, this.route, this.status, this.flightMode, }); factory Nav.fromJson(Map json) { return Nav( systemSymbol: json['systemSymbol'], waypointSymbol: json['waypointSymbol'], route: Route.fromJson(json['route']), status: json['status'], flightMode: json['flightMode'], ); } } class Route { Departure? departure; Destination? destination; String? arrival; String? departureTime; Route({ this.departure, this.destination, this.arrival, this.departureTime, }); factory Route.fromJson(Map json) { return Route( departure: Departure.fromJson(json['departure']), destination: Destination.fromJson(json['destination']), arrival: json['arrival'], departureTime: json['departureTime'], ); } } class Departure { String? symbol; String? type; String? systemSymbol; int? x; int? y; Departure({ this.symbol, this.type, this.systemSymbol, this.x, this.y, }); factory Departure.fromJson(Map json) { return Departure( symbol: json['symbol'], type: json['type'], systemSymbol: json['systemSymbol'], x: json['x'], y: json['y'], ); } } class Destination { String? symbol; String? type; String? systemSymbol; int? x; int? y; Destination({ this.symbol, this.type, this.systemSymbol, this.x, this.y, }); factory Destination.fromJson(Map json) { return Destination( symbol: json['symbol'], type: json['type'], systemSymbol: json['systemSymbol'], x: json['x'], y: json['y'], ); } } class Registration { String? name; String? factionSymbol; String? role; Registration({this.name,this.factionSymbol,this.role}); factory Registration.fromJson(Map json) { return Registration( name: json['name'], factionSymbol: json['factionSymbol'], role: json['role'], ); } } class Fuel { int? current; int? capacity; Consumed? consumed; Fuel({this.current, this.capacity, this.consumed}); factory Fuel.fromJson(Map json) { return Fuel( current: json['current'], capacity: json['capacity'], consumed: Consumed.fromJson(json['consumed']), ); } } class Cargo { int? capacity; int? units; //List? inventory; Cargo({this.capacity, this.units});//, this.inventory}); factory Cargo.fromJson(Map json) { return Cargo( capacity: json['capacity'], units: json['unit'], //inventory: json.decode(json['inventory']), ); } } class Consumed { int? amount; String? timestamp; Consumed({this.amount, this.timestamp}); factory Consumed.fromJson(Map json) { return Consumed( amount: json['amount'], timestamp: json['timestamp'], ); } }