class ExpiredPlanModel {
  final int? id;
  final int? userId;
  final int? type;
  final int? planId;
  final String? endDate;
  final String? createdDate;
  final String? planName;
  final String? price;
  final int? duration;
  final String? description;

  ExpiredPlanModel({
    this.id,
    this.userId,
    this.type,
    this.planId,
    this.endDate,
    this.createdDate,
    this.planName,
    this.price,
    this.duration,
    this.description,
  });

  factory ExpiredPlanModel.fromJson(Map<String, dynamic> json) {
    return ExpiredPlanModel(
      id:
          json['id'] is int
              ? json['id']
              : int.tryParse(json['id']?.toString() ?? ''),
      userId:
          json['user_id'] is int
              ? json['user_id']
              : int.tryParse(json['user_id']?.toString() ?? ''),
      type:
          json['type'] is int
              ? json['type']
              : int.tryParse(json['type']?.toString() ?? ''),
      planId:
          json['plan_id'] is int
              ? json['plan_id']
              : int.tryParse(json['plan_id']?.toString() ?? ''),
      endDate: json['end_date']?.toString(),
      createdDate: json['created_date']?.toString(),
      planName: json['plan_name']?.toString(),
      price: json['price']?.toString(),
      duration:
          json['duration'] is int
              ? json['duration']
              : int.tryParse(json['duration']?.toString() ?? ''),
      description: json['description']?.toString(),
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'user_id': userId,
      'type': type,
      'plan_id': planId,
      'end_date': endDate,
      'created_date': createdDate,
      'plan_name': planName,
      'price': price,
      'duration': duration,
      'description': description,
    };
  }
}
