import 'dart:convert'; 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 Nav { String? systemSymbol; String? waypointSymbol; //TODO Route String? status; String? flightMode; Nav({this.systemSymbol, this.waypointSymbol, this.status, this.flightMode}); factory Nav.fromJson(Map json) { return Nav( systemSymbol: json['systemSymbol'], waypointSymbol: json['waypointSymbol'], status: json['status'], flightMode: json['flightMode'], ); } } class Inventory { String? symbol; String? name; String? description; int? units; Inventory({this.symbol, this.name, this.description, this.units}); factory Inventory.fromJson(Map json) { return Inventory( symbol: json['symbol'], name: json['name'], description: json['description'], units: json['units'], ); } } 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'], ); } } 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 ShipModel { ShipModel({ this.symbol, this.registration, this.nav, // this.crew, // this.frame, // this.reactor, // this.engine, // this.modules, // this.mounts, this.cargo, this.fuel, }); String? symbol; Registration? registration; Nav? nav; Cargo? cargo; Fuel? fuel; factory ShipModel.fromJson(Map json) { return ShipModel( symbol: json['symbol'], registration: Registration.fromJson(json['registration']), nav: Nav.fromJson(json['nav']), cargo: Cargo.fromJson(json['cargo']), fuel: Fuel.fromJson(json['fuel']), ); } }