import 'dart:io';

import 'package:aitrainer_app/model/cache.dart';
import 'package:intl/intl.dart';

class Tracking {
  late int customerId;
  late DateTime dateAdd;
  late String event;
  String? eventValue;
  late String area;
  late String platform;
  late String version;

  Map<String, dynamic> toJson() => {
        "customerId": customerId,
        "dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd),
        "event": event,
        "eventValue": eventValue,
        "area": Platform.localeName,
        "platform": Platform.isAndroid ? "Android" : "iOS",
        "version": Cache().packageInfo != null ? Cache().packageInfo!.version + "+" + Cache().packageInfo!.buildNumber : ""
      };
}
