import 'package:intl/intl.dart';

class ProductTest {
  late int? productTestId;
  late int customerId;
  late int productId;

  late DateTime dateView;
  late bool purchaseClick;

  ProductTest();

  ProductTest.fromJson(Map json) {
    this.productTestId = json['productTestId'];
    this.customerId = json['customerId'];
    this.productId = json['productId'];
    this.dateView = DateTime.parse(json['dateView']);
    this.purchaseClick = json['purchaseClick'];
  }

  Map<String, dynamic> toJson() {
    if (productTestId != null) {
      return {
        "productTestId": productTestId,
        "customerId": customerId,
        "productId": productId,
        "dateView": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateView),
        "purchaseClick": purchaseClick
      };
    } else {
      return {
        "customerId": customerId,
        "productId": productId,
        "dateView": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateView),
        "purchaseClick": purchaseClick
      };
    }
  }
}
