class GroupInfoServerModel {
  int id;
  String groupName;
  String notice;
  bool isOpenMemberCheck;

  List<GroupServerMembers> members;

  GroupInfoServerModel({this.id, this.groupName, this.notice, this.members});

  GroupInfoServerModel.fromJson(Map<String, dynamic> json) {
    id = json['Id'];
    groupName = json['GroupName'];
    print('服务器群名:$groupName');
    notice = json['Notice'];
    isOpenMemberCheck = json['IsOpenMemberCheck']??false;

    if (json['Members'] != null) {
      members = new List<GroupServerMembers>();
      json['Members'].forEach((v) {
        members.add(new GroupServerMembers.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['Id'] = this.id;
    data['GroupName'] = this.groupName;
    data['Notice'] = this.notice;
    if (this.members != null) {
      data['Members'] = this.members.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class GroupServerMembers {
  BaseServerInfo info;
  String name;
  int identity;
  bool messageFree;
  bool effectiveUser;

  GroupServerMembers(
      {this.info,
      this.name,
      this.identity,
      this.messageFree,
      this.effectiveUser});

  GroupServerMembers.fromJson(Map<String, dynamic> json) {
    info = json['Info'] != null ? new BaseServerInfo.fromJson(json['Info']) : null;
    name = json['Name'];
    identity = json['Identity'];
    messageFree = json['MessageFree'];
    effectiveUser = json['EffectiveUser'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.info != null) {
      data['Info'] = this.info.toJson();
    }
    data['Name'] = this.name;
    data['Identity'] = this.identity;
    data['MessageFree'] = this.messageFree;
    data['EffectiveUser'] = this.effectiveUser;
    return data;
  }
}

class BaseServerInfo {
  int id;
  String niceName;
  String headUrl;

  BaseServerInfo({this.id, this.niceName, this.headUrl});

  BaseServerInfo.fromJson(Map<String, dynamic> json) {
    id = json['Id'];
    niceName = json['NiceName'];
    headUrl = json['HeadUrl'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['Id'] = this.id;
    data['NiceName'] = this.niceName;
    data['HeadUrl'] = this.headUrl;
    return data;
  }
}
