class JobStatusResponse { final bool? success; final String? message; final List? data; final dynamic errors; final int? statusCode; final String? timestamp; JobStatusResponse({ this.success, this.message, this.data, this.errors, this.statusCode, this.timestamp, }); factory JobStatusResponse.fromJson(Map json) { return JobStatusResponse( success: json['success'] as bool?, message: json['message'] as String?, data: (json['data'] as List?) ?.map((e) => JobStatus.fromJson(e)) .toList(), errors: json['errors'], statusCode: json['statusCode'] as int?, timestamp: json['timestamp'] as String?, ); } Map toJson() { return { 'success': success, 'message': message, 'data': data?.map((e) => e.toJson()).toList(), 'errors': errors, 'statusCode': statusCode, 'timestamp': timestamp, }; } } // -------------------------- // Single Job Status Model // -------------------------- class JobStatus { final String? id; final String? name; final String? displayName; final int? level; JobStatus({ this.id, this.name, this.displayName, this.level, }); factory JobStatus.fromJson(Map json) { return JobStatus( id: json['id'] as String?, name: json['name'] as String?, displayName: json['displayName'] as String?, level: json['level'] as int?, ); } Map toJson() { return { 'id': id, 'name': name, 'displayName': displayName, 'level': level, }; } // ✅ Add equality by id @override bool operator ==(Object other) => identical(this, other) || other is JobStatus && runtimeType == other.runtimeType && id == other.id; @override int get hashCode => id.hashCode; }