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

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

  factory ContactTagResponse.fromJson(Map<String, dynamic> json) {
    return ContactTagResponse(
      success: json['success'],
      message: json['message'],
      data: List<ContactTag>.from(
        json['data'].map((x) => ContactTag.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 ContactTag {
  final String id;
  final String name;
  final String description;

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

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

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