/// 申请↔报销多对多关联，对应 [ExpenseApplyMapping] 表。
class ExpenseApplyMappingModel {
  final String id;
  final String expenseId;
  final String expenseApplyId;
  final double importedAmount;
  final DateTime createTime;

  const ExpenseApplyMappingModel({
    required this.id,
    required this.expenseId,
    required this.expenseApplyId,
    required this.importedAmount,
    required this.createTime,
  });

  factory ExpenseApplyMappingModel.fromJson(Map<String, dynamic> json) {
    return ExpenseApplyMappingModel(
      id: json['id'] as String,
      expenseId: json['expenseId'] as String? ?? '',
      expenseApplyId: json['expenseApplyId'] as String? ?? '',
      importedAmount:
          (json['importedAmount'] as num?)?.toDouble() ?? 0.0,
      createTime: DateTime.parse(json['createTime'] as String),
    );
  }

  Map<String, dynamic> toJson() => {
        'id': id,
        'expenseId': expenseId,
        'expenseApplyId': expenseApplyId,
        'importedAmount': importedAmount,
        'createTime': createTime.toIso8601String(),
      };
}
