// transit_admin_models.dart — نماذج بيانات مواصلاتي (لوحة إدارة سيرو) class TransitOrgSummary { final int id; final String type; final String country; final String city; final String nameAr; final String nameEn; final String? logoUrl; final String contractStatus; final String? trialEndsAt; final int driversCount; final int vehiclesCount; final int activeRoutes; final int activeEnrollments; TransitOrgSummary({ required this.id, required this.type, required this.country, required this.city, required this.nameAr, required this.nameEn, required this.contractStatus, this.logoUrl, this.trialEndsAt, this.driversCount = 0, this.vehiclesCount = 0, this.activeRoutes = 0, this.activeEnrollments = 0, }); factory TransitOrgSummary.fromJson(Map j) => TransitOrgSummary( id: int.tryParse(j['id'].toString()) ?? 0, type: j['type']?.toString() ?? '', country: j['country']?.toString() ?? '', city: j['city']?.toString() ?? '', nameAr: j['name_ar']?.toString() ?? '', nameEn: j['name_en']?.toString() ?? '', logoUrl: j['logo_url']?.toString(), contractStatus: j['contract_status']?.toString() ?? '', trialEndsAt: j['trial_ends_at']?.toString(), driversCount: int.tryParse(j['drivers_count']?.toString() ?? '0') ?? 0, vehiclesCount: int.tryParse(j['vehicles_count']?.toString() ?? '0') ?? 0, activeRoutes: int.tryParse(j['active_routes']?.toString() ?? '0') ?? 0, activeEnrollments: int.tryParse(j['active_enrollments']?.toString() ?? '0') ?? 0, ); } class TransitOrgDetails { final Map org; final Map counts; final Map trips; final List routes; TransitOrgDetails({ required this.org, required this.counts, required this.trips, required this.routes, }); factory TransitOrgDetails.fromJson(Map j) => TransitOrgDetails( org: Map.from(j['org'] ?? {}), counts: Map.from(j['counts'] ?? {}), trips: Map.from(j['trips'] ?? {}), routes: (j['routes'] is List) ? List.from(j['routes']) : [], ); }