class Data {
  final String p;
  final String h;
  final String l;
  final String d;
  final double dp;
  final String dt;
  final String t;
  final String? tEn;
  final String tG;
  final String ts;

  Data({
    required this.p,
    required this.h,
    required this.l,
    required this.d,
    required this.dp,
    required this.dt,
    required this.t,
    required this.tEn,
    required this.tG,
    required this.ts,
  });

  factory Data.fromJson(Map<String, dynamic> json) => Data(
        p: json['p'],
        h: json['h'],
        l: json['l'],
        d: json['d'],
        dp: double.parse(json['dp'].toString()),
        dt: json['dt'],
        t: json['t'],
        tEn: json['t_en'],
        tG: json['t-g'],
        ts: json['ts'],
      );

  factory Data.fromList(List list) => Data(
        p: list[0],
        h: list[1],
        l: list[2],
        d: list[3],
        dp: double.parse(list[4].toString().replaceAll('-', '0')),
        dt: list[5],
        t: list[6],
        tEn: list[7],
        tG: '',
        ts: '',
      );

  Map<String, dynamic> toJson() => {
        'p': p,
        'h': h,
        'l': l,
        'd': d,
        'dp': dp,
        'dt': dt,
        't': t,
        't_en': tEn,
        't-g': tG,
        'ts': ts,
      };
}
