class ContactCategoryResponse {
  final bool success;
  final String message;
  final List<ContactCategory> data;
  final dynamic errors;
  final int statusCode;
  final DateTime timestamp;

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

  factory ContactCategoryResponse.fromJson(Map<String, dynamic> json) {
    return ContactCategoryResponse(
      success: json['success'],
      message: json['message'],
      data: List<ContactCategory>.from(
        json['data'].map((x) => ContactCategory.fromJson(x)),
      ),
      errors: json['errors'],
      statusCode: json['statusCode'],
      timestamp: DateTime.parse(json['timestamp']),
    );
  }

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

class ContactCategory {
  final String id;
  final String name;
  final String description;

  ContactCategory({
    required this.id,
    required this.name,
    required this.description,
  });

  factory ContactCategory.fromJson(Map<String, dynamic> json) {
    return ContactCategory(
      id: json['id'],
      name: json['name'],
      description: json['description'],
    );
  }

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