

/// score : 0
/// isSignIn : 1
/// days : 31
/// currentDay : 1
/// startScore : 100
/// addScore : 100
/// goods : [{"id":1,"s":15000,"h":18,"state":1},{"id":2,"s":30000,"h":38,"state":0},{"id":7,"s":49600,"h":88,"state":0}]

class DailyBonusBean {
  int score=0;
  int isSignIn=0;
  int currentDay=0;
  int days=31;
  int startScore;
  int addScore;
  List<GoodsBean> goods;

  static DailyBonusBean fromMap(Map<String, dynamic> map) {
    if (map == null) return null;
    DailyBonusBean dataBean = DailyBonusBean();
    dataBean.score = map['score'];
    dataBean.isSignIn = map['isSignIn'];
    dataBean.days = map['days'];
    dataBean.currentDay = map['currentDay'];
    dataBean.startScore = map['startScore'];
    dataBean.addScore = map['addScore'];
    dataBean.goods = List()..addAll(
      (map['goods'] as List ?? []).map((o) => GoodsBean.fromMap(o))
    );
    return dataBean;
  }

  Map toJson() => {
    "score": score,
    "isSignIn": isSignIn,
    "days": days,
    "currentDay": currentDay,
    "startScore": startScore,
    "addScore": addScore,
    "goods": goods,
  };
}

/// id : 1
/// s : 15000
/// h : 18
/// state : 1

class GoodsBean {
  int id;
  int s;
  int h;
  int state;

  static GoodsBean fromMap(Map<String, dynamic> map) {
    if (map == null) return null;
    GoodsBean goodsBean = GoodsBean();
    goodsBean.id = map['id'];
    goodsBean.s = map['s'];
    goodsBean.h = map['h'];
    goodsBean.state = map['state'];
    return goodsBean;
  }

  Map toJson() => {
    "id": id,
    "s": s,
    "h": h,
    "state": state,
  };
}