import 'dart:convert' show json;

T asT<T>(dynamic value) {
  if (value is T) {
    return value;
  }

  return null;
}

class UserXieyi {
  UserXieyi({
    this.id,
    this.createTime,
    this.createBy,
    this.updateTime,
    this.updateBy,
    this.name,
    this.createUserId,
    this.url,
    this.fileName,
    this.template,
    this.statuz,
    this.type,
    this.nickname,
    this.headUrl,
  });

  factory UserXieyi.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
      ? null
      : UserXieyi(
          id: asT<int>(jsonRes['id']),
          createTime: asT<int>(jsonRes['createTime']),
          createBy: asT<Object>(jsonRes['createBy']),
          updateTime: asT<int>(jsonRes['updateTime']),
          updateBy: asT<Object>(jsonRes['updateBy']),
          name: asT<String>(jsonRes['name']),
          createUserId: asT<String>(jsonRes['createUserId']),
          url: asT<String>(jsonRes['url']),
          fileName: asT<String>(jsonRes['fileName']),
          template: asT<Object>(jsonRes['template']),
          statuz: asT<int>(jsonRes['statuz']),
          type: asT<int>(jsonRes['type']),
          nickname: asT<String>(jsonRes['nickname']),
          headUrl: asT<String>(jsonRes['headUrl']),
        );

  int id;
  int createTime;
  Object createBy;
  int updateTime;
  Object updateBy;
  String name;
  String createUserId;
  String url;
  String fileName;
  Object template;
  int statuz;
  int type;
  String nickname;
  String headUrl;

  Map<String, dynamic> toJson() => <String, dynamic>{
        'id': id,
        'createTime': createTime,
        'createBy': createBy,
        'updateTime': updateTime,
        'updateBy': updateBy,
        'name': name,
        'createUserId': createUserId,
        'url': url,
        'fileName': fileName,
        'template': template,
        'statuz': statuz,
        'type': type,
        'nickname': nickname,
        'headUrl': headUrl,
      };
  @override
  String toString() {
    return json.encode(this);
  }
}
