class DailyProgressReportFilterResponse {
  final bool success;
  final String message;
  final FilterData? data;
  final dynamic errors;
  final int statusCode;
  final String timestamp;

  DailyProgressReportFilterResponse({
    required this.success,
    required this.message,
    this.data,
    this.errors,
    required this.statusCode,
    required this.timestamp,
  });

  factory DailyProgressReportFilterResponse.fromJson(Map<String, dynamic> json) {
    return DailyProgressReportFilterResponse(
      success: json['success'],
      message: json['message'],
      data: json['data'] != null ? FilterData.fromJson(json['data']) : null,
      errors: json['errors'],
      statusCode: json['statusCode'],
      timestamp: json['timestamp'],
    );
  }

  Map<String, dynamic> toJson() => {
        'success': success,
        'message': message,
        'data': data?.toJson(),
        'errors': errors,
        'statusCode': statusCode,
        'timestamp': timestamp,
      };
}

class FilterData {
  final List<Building> buildings;
  final List<Floor> floors;
  final List<Activity> activities;
  final List<Service> services;

  FilterData({
    required this.buildings,
    required this.floors,
    required this.activities,
    required this.services,
  });

  factory FilterData.fromJson(Map<String, dynamic> json) {
    return FilterData(
      buildings: (json['buildings'] as List)
          .map((e) => Building.fromJson(e))
          .toList(),
      floors:
          (json['floors'] as List).map((e) => Floor.fromJson(e)).toList(),
      activities:
          (json['activities'] as List).map((e) => Activity.fromJson(e)).toList(),
      services:
          (json['services'] as List).map((e) => Service.fromJson(e)).toList(),
    );
  }

  Map<String, dynamic> toJson() => {
        'buildings': buildings.map((e) => e.toJson()).toList(),
        'floors': floors.map((e) => e.toJson()).toList(),
        'activities': activities.map((e) => e.toJson()).toList(),
        'services': services.map((e) => e.toJson()).toList(),
      };
}

class Building {
  final String id;
  final String name;

  Building({required this.id, required this.name});

  factory Building.fromJson(Map<String, dynamic> json) =>
      Building(id: json['id'], name: json['name']);

  Map<String, dynamic> toJson() => {'id': id, 'name': name};
}

class Floor {
  final String id;
  final String name;
  final String buildingId;

  Floor({required this.id, required this.name, required this.buildingId});

  factory Floor.fromJson(Map<String, dynamic> json) => Floor(
        id: json['id'],
        name: json['name'],
        buildingId: json['buildingId'],
      );

  Map<String, dynamic> toJson() => {
        'id': id,
        'name': name,
        'buildingId': buildingId,
      };
}

class Activity {
  final String id;
  final String name;

  Activity({required this.id, required this.name});

  factory Activity.fromJson(Map<String, dynamic> json) =>
      Activity(id: json['id'], name: json['name']);

  Map<String, dynamic> toJson() => {'id': id, 'name': name};
}

class Service {
  final String id;
  final String name;

  Service({required this.id, required this.name});

  factory Service.fromJson(Map<String, dynamic> json) =>
      Service(id: json['id'], name: json['name']);

  Map<String, dynamic> toJson() => {'id': id, 'name': name};
}
