class SwipeHistory {
  final int? id;
  final String? swipeTypeName;
  final String? userName;
  final String? siteName;
  final String? pointName;
  final String? swipeTime;
  final bool? isSuccess;
  final String? errorMessage;

  SwipeHistory({
    this.id,
    this.swipeTypeName,
    this.userName,
    this.siteName,
    this.pointName,
    this.swipeTime,
    this.isSuccess,
    this.errorMessage,
  });

  factory SwipeHistory.fromJson(Map<String, dynamic> json) {
    return SwipeHistory(
      id: json['id'],
      swipeTypeName: json['swipeTypeName'],
      userName: json['userName'],
      siteName: json['siteName'],
      pointName: json['pointName'],
      swipeTime: json['swipeTime'] != null ? DateTime.parse(json['swipeTime']).toIso8601String() : '',
      isSuccess: json['isSuccess'],
      errorMessage: json['errorMessage'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'swipeTypeName': swipeTypeName,
      'userName': userName,
      'siteName': siteName,
      'pointName': pointName,
      'swipeTime': swipeTime,
      'isSuccess': isSuccess,
      'errorMessage': errorMessage,
    };
  }
}
