// dashboard_projects_model.dart
class DashboardProjects {
  final bool success;
  final String message;
  final DashboardProjectsData? data;
  final dynamic errors;
  final int statusCode;
  final DateTime timestamp;

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

  factory DashboardProjects.fromJson(Map<String, dynamic> json) {
    return DashboardProjects(
      success: json['success'] ?? false,
      message: json['message'] ?? '',
      data: json['data'] != null ? DashboardProjectsData.fromJson(json['data']) : null,
      errors: json['errors'],
      statusCode: json['statusCode'] ?? 0,
      timestamp: DateTime.parse(json['timestamp']),
    );
  }
}

class DashboardProjectsData {
  final int totalProjects;
  final int ongoingProjects;

  DashboardProjectsData({
    required this.totalProjects,
    required this.ongoingProjects,
  });

  factory DashboardProjectsData.fromJson(Map<String, dynamic> json) {
    return DashboardProjectsData(
      totalProjects: json['totalProjects'] ?? 0,
      ongoingProjects: json['ongoingProjects'] ?? 0,
    );
  }
}
