
import 'package:satu/core/utils/utils_parse.dart';

class AnalyticsBean {
  StatsBean? stats;
  num? money;

  static AnalyticsBean? fromMap(dynamic map) {
    if (map == null) return null;

    final AnalyticsBean item = AnalyticsBean();
    item.stats = StatsBean.fromMap(map['stats']);
    item.money = cast<num>(map['money']);
    return item;
  }
}

class StatsBean {
  String? todayDate;
  String? yesterdayDate;
  String? weekDate;
  String? monthDate;
  StatItem? today;
  StatItem? yesterday;
  StatItem? week;
  StatItem? month;
  static StatsBean? fromMap(dynamic map) {
    if (map == null) return null;
    final StatsBean item = StatsBean();
    item.todayDate = cast<String>(map['today_date']);
    item.yesterdayDate = cast<String>(map['yesterday_date']);
    item.weekDate = cast<String>(map['week_date']);
    item.monthDate = cast<String>(map['month_date']);
    item.today = StatItem.fromMap(map['today']);
    item.yesterday = StatItem.fromMap(map['yesterday']);
    item.week = StatItem.fromMap(map['week']);
    item.month = StatItem.fromMap(map['month']);
    return item;
  }
}

class StatItem {
  num? cnt;
  num? summ;
  static StatItem? fromMap(dynamic map) {
    if (map == null) return null;
    final StatItem item = StatItem();
    item.cnt = cast<num>(map['cnt']);
    item.summ = cast<num>(map['summ']);
    return item;
  }
}