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

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

  factory PaymentModeResponse.fromJson(Map<String, dynamic> json) {
    return PaymentModeResponse(
      success: json['success'] as bool,
      message: json['message'] as String,
      data: (json['data'] as List)
          .map((item) => PaymentModeData.fromJson(item))
          .toList(),
      errors: json['errors'],
      statusCode: json['statusCode'] as int,
      timestamp: DateTime.parse(json['timestamp'] as String),
    );
  }

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

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

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

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

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