import 'package:json_annotation/json_annotation.dart';

part 'mine_quick_model.g.dart';

@JsonSerializable()
class MineQuickModel extends Object {
  @JsonKey(name: 'my_functions_text')
  String title;

  @JsonKey(name: 'my_functions_text_color')
  String titleColor;

  @JsonKey(name: 'layout')
  String layout;

  @JsonKey(name: 'functions_bg_color')
  String myFunctionsBgColor;

  @JsonKey(name: 'functions_list')
  List<MineQuickItemModel> items;

  MineQuickModel(
    this.title,
    this.titleColor,
    this.layout,
    this.myFunctionsBgColor,
    this.items,
  );

  factory MineQuickModel.fromJson(Map<String, dynamic> srcJson) =>
      _$MineQuickModelFromJson(srcJson);

  Map<String, dynamic> toJson() => _$MineQuickModelToJson(this);
}

@JsonSerializable()
class MineQuickItemModel extends Object {
  @JsonKey(name: 'name')
  String name;

  @JsonKey(name: 'name_color')
  String nameColor;

  @JsonKey(name: 'icon')
  String icon;

  @JsonKey(name: 'required_login')
  String requiredLogin;

  @JsonKey(name: 'required_taobao_auth')
  String requiredTaobaoAuth;

  @JsonKey(name: 'skip_identifier')
  String skipIdentifier;

  MineQuickItemModel(
    this.name,
    this.icon,
    this.requiredLogin,
    this.requiredTaobaoAuth,
    this.skipIdentifier,
  );

  factory MineQuickItemModel.fromJson(Map<String, dynamic> srcJson) =>
      _$MineQuickItemModelFromJson(srcJson);

  Map<String, dynamic> toJson() => _$MineQuickItemModelToJson(this);
}
