import 'package:yumi/shared/data_sources/sources/local/user_manager.dart';

import '../../../data_sources/models/enum/sc_props_type.dart';

/// token : ""
/// userCredential : {"expireTime":0,"releaseTime":0,"sign":"","sysOrigin":"","userId":0,"version":""}
/// userProfile : {"account":"","accountStatus":"","age":0,"bornDay":0,"bornMonth":0,"bornYear":0,"countryCode":"","countryId":0,"countryName":"","createTime":0,"del":false,"freezingTime":0,"id":0,"originSys":"","ownSpecialId":{"account":"","expiredTime":0},"sameRegion":false,"sysOriginChild":"","useProps":[{"expireTime":0,"propsResources":{"amount":0.0,"code":"","cover":"","expand":"","id":0,"name":"","sourceUrl":"","type":""},"userId":0}],"userAvatar":"","userNickname":"","userSex":0,"wearBadge":[{"animationUrl":"","badgeKey":"","badgeLevel":0,"badgeName":"","expireTime":0,"id":0,"milestone":0,"notSelectUrl":"","selectUrl":"","type":"","userId":0}]}
/// userSig : ""

class SocialChatLoginRes {
  SocialChatLoginRes({
    String? token,
    SocialChatUserCredential? userCredential,
    SocialChatUserProfile? userProfile,
    String? userSig,
  }) {
    _token = token;
    _userCredential = userCredential;
    _userProfile = userProfile;
    _userSig = userSig;
  }

  SocialChatLoginRes.fromJson(dynamic json) {
    _token = json['token'];
    _userCredential =
        json['userCredential'] != null
            ? SocialChatUserCredential.fromJson(json['userCredential'])
            : null;
    _userProfile =
        json['userProfile'] != null
            ? SocialChatUserProfile.fromJson(json['userProfile'])
            : null;
    _userSig = json['userSig'];
  }

  String? _token;
  SocialChatUserCredential? _userCredential;
  SocialChatUserProfile? _userProfile;
  String? _userSig;

  SocialChatLoginRes copyWith({
    String? token,
    SocialChatUserCredential? userCredential,
    SocialChatUserProfile? userProfile,
    String? userSig,
  }) => SocialChatLoginRes(
    token: token ?? _token,
    userCredential: userCredential ?? _userCredential,
    userProfile: userProfile ?? _userProfile,
    userSig: userSig ?? _userSig,
  );

  String? get token => _token;

  SocialChatUserCredential? get userCredential => _userCredential;

  SocialChatUserProfile? get userProfile => _userProfile;

  String? get userSig => _userSig;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['token'] = _token;
    if (_userCredential != null) {
      map['userCredential'] = _userCredential?.toJson();
    }
    if (_userProfile != null) {
      map['userProfile'] = _userProfile?.toJson();
    }
    map['userSig'] = _userSig;
    return map;
  }

  void setUserProfile(SocialChatUserProfile userInfo) {
    _userProfile = userInfo;
  }
}

/// account : ""
/// accountStatus : ""
/// age : 0
/// bornDay : 0
/// bornMonth : 0
/// bornYear : 0
/// countryCode : ""
/// countryId : 0
/// countryName : ""
/// createTime : 0
/// del : false
/// freezingTime : 0
/// id : 0
/// originSys : ""
/// ownSpecialId : {"account":"","expiredTime":0}
/// sameRegion : false
/// sysOriginChild : ""
/// useProps : [{"expireTime":0,"propsResources":{"amount":0.0,"code":"","cover":"","expand":"","id":0,"name":"","sourceUrl":"","type":""},"userId":0}]
/// userAvatar : ""
/// userNickname : ""
/// userSex : 0
/// wearBadge : [{"animationUrl":"","badgeKey":"","badgeLevel":0,"badgeName":"","expireTime":0,"id":0,"milestone":0,"notSelectUrl":"","selectUrl":"","type":"","userId":0}]

class SocialChatUserProfile {
  SocialChatUserProfile({
    String? account,
    String? accountStatus,
    num? age,
    num? bornDay,
    num? bornMonth,
    num? bornYear,
    String? countryCode,
    String? countryId,
    String? countryName,
    num? createTime,
    bool? del,
    num? freezingTime,
    String? id,
    bool? firstRecharge,
    num? charmLevel,
    num? firstRechargeAmount,
    num? wealthLevel,
    num? heartbeatVal,
    String? originSys,
    OwnSpecialId? ownSpecialId,
    bool? sameRegion,
    int? firstRechargeEndTime,
    String? sysOriginChild,
    List<UseProps>? useProps,
    String? userAvatar,
    String? roles,
    String? inRoomId,
    String? userNickname,
    String? hobby,
    String? familyId,
    String? autograph,
    num? userSex,
    List<WearBadge>? wearBadge,
    List<WearBadge>? wearHonor,
    List<PersonPhoto>? backgroundPhotos,
    List<PersonPhoto>? personalPhotos,
    List<CPRes>? cpList,
    bool? isCpRelation,
  }) {
    _account = account;
    _accountStatus = accountStatus;
    _age = age;
    _bornDay = bornDay;
    _inRoomId = inRoomId;
    _bornMonth = bornMonth;
    _bornYear = bornYear;
    _countryCode = countryCode;
    _countryId = countryId;
    _countryName = countryName;
    _createTime = createTime;
    _del = del;
    _freezingTime = freezingTime;
    _id = id;
    _originSys = originSys;
    _charmLevel = charmLevel;
    _firstRechargeAmount = firstRechargeAmount;
    _wealthLevel = wealthLevel;
    _heartbeatVal = heartbeatVal;
    _ownSpecialId = ownSpecialId;
    _sameRegion = sameRegion;
    _isCpRelation = isCpRelation;
    _firstRechargeEndTime = firstRechargeEndTime;
    _firstRecharge = firstRecharge;
    _sysOriginChild = sysOriginChild;
    _useProps = useProps;
    _userAvatar = userAvatar;
    _roles = roles;
    _userNickname = userNickname;
    _hobby = hobby;
    _familyId = familyId;
    _autograph = autograph;
    _userSex = userSex;
    _wearBadge = wearBadge;
    _wearHonor = wearHonor;
    _backgroundPhotos = backgroundPhotos;
    _personalPhotos = personalPhotos;
    _cpList = cpList;
  }

  SocialChatUserProfile.fromJson(dynamic json) {
    _account = json['account'];
    _accountStatus = json['accountStatus'];
    _age = json['age'];
    _bornDay = json['bornDay'];
    _inRoomId = json['inRoomId'];
    _bornMonth = json['bornMonth'];
    _bornYear = json['bornYear'];
    _countryCode = json['countryCode'];
    _countryId = json['countryId'];
    _countryName = json['countryName'];
    _createTime = json['createTime'];
    _del = json['del'];
    _freezingTime = json['freezingTime'];
    _id = json['id'];
    _originSys = json['originSys'];
    _charmLevel = json['charmLevel'];
    _firstRechargeAmount = json['firstRechargeAmount'];
    _wealthLevel = json['wealthLevel'];
    _heartbeatVal = json['heartbeatVal'];
    _ownSpecialId =
        json['ownSpecialId'] != null
            ? OwnSpecialId.fromJson(json['ownSpecialId'])
            : null;
    _sameRegion = json['sameRegion'];
    _isCpRelation = json['isCpRelation'];
    _firstRechargeEndTime = json['firstRechargeEndTime'];
    _firstRecharge = json['firstRecharge'];
    _sysOriginChild = json['sysOriginChild'];
    if (json['useProps'] != null) {
      _useProps = [];
      json['useProps'].forEach((v) {
        _useProps?.add(UseProps.fromJson(v));
      });
    }
    _userAvatar = json['userAvatar'] ?? json['avatar'];
    _roles = json['roles'];
    _userNickname = json['userNickname'];
    _hobby = json['hobby'];
    _familyId = json['familyId'];
    _autograph = json['autograph'];
    _userSex = json['userSex'];
    if (json['wearBadge'] != null) {
      _wearBadge = [];
      json['wearBadge'].forEach((v) {
        _wearBadge?.add(WearBadge.fromJson(v));
      });
    }
    if (json['wearHonor'] != null) {
      _wearHonor = [];
      json['wearHonor'].forEach((v) {
        _wearHonor?.add(WearBadge.fromJson(v));
      });
    }
    if (json['backgroundPhotos'] != null) {
      _backgroundPhotos = [];
      json['backgroundPhotos'].forEach((v) {
        _backgroundPhotos?.add(PersonPhoto.fromJson(v));
      });
    }
    if (json['personalPhotos'] != null) {
      _personalPhotos = [];
      json['personalPhotos'].forEach((v) {
        _personalPhotos?.add(PersonPhoto.fromJson(v));
      });
    }
    if (json['cpList'] != null) {
      _cpList = [];
      json['cpList'].forEach((v) {
        _cpList?.add(CPRes.fromJson(v));
      });
    }
  }

  String? _account;
  String? _accountStatus;
  num? _age;
  num? _bornDay;
  num? _bornMonth;
  num? _bornYear;
  String? _countryCode;
  String? _countryId;
  String? _inRoomId;
  String? _countryName;
  num? _createTime;
  bool? _del;
  num? _freezingTime;
  String? _id;
  String? _originSys;
  num? _charmLevel;
  num? _firstRechargeAmount;
  num? _wealthLevel;
  num? _heartbeatVal;
  OwnSpecialId? _ownSpecialId;
  bool? _sameRegion;
  bool? _isCpRelation;
  int? _firstRechargeEndTime;
  bool? _firstRecharge;
  String? _sysOriginChild;
  List<UseProps>? _useProps;
  String? _userAvatar;
  String? _roles;
  String? _userNickname;
  String? _hobby;
  String? _familyId;
  String? _autograph;
  num? _userSex;
  List<WearBadge>? _wearBadge;
  List<WearBadge>? _wearHonor;
  List<PersonPhoto>? _backgroundPhotos;
  List<PersonPhoto>? _personalPhotos;
  List<CPRes>? _cpList;

  SocialChatUserProfile copyWith({
    String? account,
    String? accountStatus,
    num? age,
    num? bornDay,
    num? bornMonth,
    num? bornYear,
    String? countryCode,
    String? countryId,
    String? countryName,
    num? createTime,
    bool? del,
    num? freezingTime,
    String? id,
    String? originSys,
    String? inRoomId,
    num? charmLevel,
    num? firstRechargeAmount,
    num? wealthLevel,
    num? heartbeatVal,
    OwnSpecialId? ownSpecialId,
    bool? sameRegion,
    bool? isCpRelation,
    int? firstRechargeEndTime,
    bool? firstRecharge,
    String? sysOriginChild,
    List<UseProps>? useProps,
    String? userAvatar,
    String? roles,
    String? userNickname,
    String? hobby,
    String? familyId,
    String? autograph,
    num? userSex,
    List<WearBadge>? wearBadge,
    List<WearBadge>? wearHonor,
    List<PersonPhoto>? backgroundPhotos,
    List<PersonPhoto>? personalPhotos,
    List<CPRes>? cpList,
  }) => SocialChatUserProfile(
    account: account ?? _account,
    accountStatus: accountStatus ?? _accountStatus,
    age: age ?? _age,
    bornDay: bornDay ?? _bornDay,
    bornMonth: bornMonth ?? _bornMonth,
    bornYear: bornYear ?? _bornYear,
    inRoomId: inRoomId ?? _inRoomId,
    countryCode: countryCode ?? _countryCode,
    countryId: countryId ?? _countryId,
    countryName: countryName ?? _countryName,
    createTime: createTime ?? _createTime,
    del: del ?? _del,
    freezingTime: freezingTime ?? _freezingTime,
    id: id ?? _id,
    originSys: originSys ?? _originSys,
    charmLevel: charmLevel ?? _charmLevel,
    firstRechargeAmount: firstRechargeAmount ?? _firstRechargeAmount,
    wealthLevel: wealthLevel ?? _wealthLevel,
    heartbeatVal: heartbeatVal ?? _heartbeatVal,
    ownSpecialId: ownSpecialId ?? _ownSpecialId,
    sameRegion: sameRegion ?? _sameRegion,
    isCpRelation: isCpRelation ?? _isCpRelation,
    firstRechargeEndTime: firstRechargeEndTime ?? _firstRechargeEndTime,
    firstRecharge: firstRecharge ?? _firstRecharge,
    sysOriginChild: sysOriginChild ?? _sysOriginChild,
    useProps: useProps ?? _useProps,
    userAvatar: userAvatar ?? _userAvatar,
    roles: roles ?? _roles,
    userNickname: userNickname ?? _userNickname,
    hobby: hobby ?? _hobby,
    familyId: familyId ?? _familyId,
    autograph: autograph ?? _autograph,
    userSex: userSex ?? _userSex,
    wearBadge: wearBadge ?? _wearBadge,
    wearHonor: wearHonor ?? _wearHonor,
    backgroundPhotos: backgroundPhotos ?? _backgroundPhotos,
    personalPhotos: personalPhotos ?? _personalPhotos,
    cpList: cpList ?? _cpList,
  );

  String? get account => _account;

  String? get inRoomId => _inRoomId;

  String? get accountStatus => _accountStatus;

  num? get age => (_age ?? 0) < 1 ? 18 : _age;

  num? get bornDay => _bornDay;

  num? get bornMonth => _bornMonth;

  num? get bornYear => _bornYear;

  String? get countryCode => _countryCode;

  String? get countryId => _countryId;

  String? get countryName => _countryName;

  num? get createTime => _createTime;

  bool? get del => _del;

  num? get freezingTime => _freezingTime;

  String? get id => _id;

  String? get originSys => _originSys;

  num? get charmLevel => _charmLevel;

  num? get firstRechargeAmount => _firstRechargeAmount;

  num? get wealthLevel => _wealthLevel;

  num? get heartbeatVal => _heartbeatVal;

  OwnSpecialId? get ownSpecialId => _ownSpecialId;

  bool? get sameRegion => _sameRegion;

  bool? get isCpRelation => _isCpRelation;

  int? get firstRechargeEndTime => _firstRechargeEndTime;

  bool? get firstRecharge => _firstRecharge;

  String? get sysOriginChild => _sysOriginChild;

  List<UseProps>? get useProps => _useProps;

  String? get userAvatar => _userAvatar;

  String? get roles => _roles;

  String? get userNickname => _userNickname;

  String? get hobby => _hobby;

  String? get familyId => _familyId;

  String? get autograph => _autograph;

  num? get userSex => _userSex;

  List<WearBadge>? get wearBadge => _wearBadge;

  List<WearBadge>? get wearHonor => _wearHonor;

  List<PersonPhoto>? get backgroundPhotos => _backgroundPhotos;

  List<PersonPhoto>? get personalPhotos => _personalPhotos;

  List<CPRes>? get cpList => _cpList;

  void setFamilyId(String? familyId) {
    _familyId = familyId;
    AccountStorage().setCurrentUser(AccountStorage().getCurrentUser()!);
  }

  ///清除荣耀信息，避免发送消息个人信息数据太多超12kb,注意这个只在房间发消息的时候才用，因为荣耀这个属性数据在房间里面不用展示
  void cleanWearHonor() {
    _wearHonor?.clear();
  }

  ///同上
  void cleanWearBadge() {
    _wearBadge?.clear();
  }

  void cleanUseProps() {
    _useProps?.clear();
  }

  void cleanPhotos() {
    _backgroundPhotos?.clear();
    _personalPhotos?.clear();
    _cpList?.clear();
  }

  PropsResources? getHeaddress() {
    PropsResources? pr;
    _useProps?.forEach((value) {
      if (value.propsResources?.type == SCPropsType.AVATAR_FRAME.name) {
        pr = value.propsResources;
      }
    });
    return pr;
  }

  PropsResources? getChatBox() {
    PropsResources? pr;
    _useProps?.forEach((value) {
      if (value.propsResources?.type == SCPropsType.CHAT_BUBBLE.name) {
        pr = value.propsResources;
      }
    });
    return pr;
  }

  PropsResources? getMountains() {
    PropsResources? pr;
    _useProps?.forEach((value) {
      if (value.propsResources?.type == SCPropsType.RIDE.name) {
        pr = value.propsResources;
      }
    });
    return pr;
  }

  PropsResources? getVIP() {
    return null;
  }

  PropsResources? getDataCard() {
    PropsResources? pr;
    _useProps?.forEach((value) {
      if (value.propsResources?.type == SCPropsType.DATA_CARD.name) {
        pr = value.propsResources;
      }
    });
    return pr;
  }

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['account'] = _account;
    map['accountStatus'] = _accountStatus;
    map['age'] = _age;
    map['bornDay'] = _bornDay;
    map['bornMonth'] = _bornMonth;
    map['bornYear'] = _bornYear;
    map['countryCode'] = _countryCode;
    map['countryId'] = _countryId;
    map['countryName'] = _countryName;
    map['createTime'] = _createTime;
    map['del'] = _del;
    map['freezingTime'] = _freezingTime;
    map['id'] = _id;
    map['originSys'] = _originSys;
    map['charmLevel'] = _charmLevel;
    map['firstRechargeAmount'] = _firstRechargeAmount;
    map['wealthLevel'] = _wealthLevel;
    map['heartbeatVal'] = _heartbeatVal;
    if (_ownSpecialId != null) {
      map['ownSpecialId'] = _ownSpecialId?.toJson();
    }
    map['sameRegion'] = _sameRegion;
    map['isCpRelation'] = _isCpRelation;
    map['firstRecharge'] = _firstRecharge;
    map['firstRechargeEndTime'] = _firstRechargeEndTime;
    map['sysOriginChild'] = _sysOriginChild;
    if (_useProps != null) {
      map['useProps'] = _useProps?.map((v) => v.toJson()).toList();
    }
    map['userAvatar'] = _userAvatar;
    map['roles'] = _roles;
    map['userNickname'] = _userNickname;
    map['hobby'] = _hobby;
    map['familyId'] = _familyId;
    map['autograph'] = _autograph;
    map['userSex'] = _userSex;
    if (_wearBadge != null) {
      map['wearBadge'] = _wearBadge?.map((v) => v.toJson()).toList();
    }
    if (_wearHonor != null) {
      map['wearHonor'] = _wearHonor?.map((v) => v.toJson()).toList();
    }
    return map;
  }

  ///获取Id，有靓号显示靓号
  String getID() {
    String uid = account ?? "";
    if (_ownSpecialId != null) {
      uid = _ownSpecialId?.account ?? "";
    }
    return uid;
  }

  ///是否有靓号
  bool hasSpecialId() {
    if (_ownSpecialId != null) {
      if ((_ownSpecialId?.expiredTime ?? 0) >
          DateTime.now().millisecondsSinceEpoch) {
        return true;
      }
    }
    return false;
  }

  void setHeartbeatVal(num? heartbeatVal) {
    _heartbeatVal = (_heartbeatVal ?? 0) + (heartbeatVal ?? 0);
  }
}

/// animationUrl : ""
/// badgeKey : ""
/// badgeLevel : 0
/// badgeName : ""
/// expireTime : 0
/// id : 0
/// milestone : 0
/// notSelectUrl : ""
/// selectUrl : ""
/// type : ""
/// userId : 0

class WearBadge {
  WearBadge({
    String? animationUrl,
    String? badgeKey,
    num? badgeLevel,
    String? badgeName,
    int? expireTime,
    String? id,
    String? milestone,
    String? notSelectUrl,
    String? selectUrl,
    String? type,
    String? userId,
    bool? use,
  }) {
    _animationUrl = animationUrl;
    _badgeKey = badgeKey;
    _badgeLevel = badgeLevel;
    _badgeName = badgeName;
    _expireTime = expireTime;
    _id = id;
    _use = use;
    _milestone = milestone;
    _notSelectUrl = notSelectUrl;
    _selectUrl = selectUrl;
    _type = type;
    _userId = userId;
  }

  WearBadge.fromJson(dynamic json) {
    _animationUrl = json['animationUrl'];
    _badgeKey = json['badgeKey'];
    _badgeLevel = json['badgeLevel'];
    _badgeName = json['badgeName'];
    _expireTime = json['expireTime'];
    _id = json['id'];
    _use = json['use'];
    _milestone = json['milestone'];
    _notSelectUrl = json['notSelectUrl'];
    _selectUrl = json['selectUrl'];
    _type = json['type'];
    _userId = json['userId'];
  }

  String? _animationUrl;
  String? _badgeKey;
  num? _badgeLevel;
  String? _badgeName;
  int? _expireTime;
  String? _id;
  bool? _use;
  String? _milestone;
  String? _notSelectUrl;
  String? _selectUrl;
  String? _type;
  String? _userId;

  WearBadge copyWith({
    String? animationUrl,
    String? badgeKey,
    num? badgeLevel,
    String? badgeName,
    int? expireTime,
    String? id,
    bool? use,
    String? milestone,
    String? notSelectUrl,
    String? selectUrl,
    String? type,
    String? userId,
  }) => WearBadge(
    animationUrl: animationUrl ?? _animationUrl,
    badgeKey: badgeKey ?? _badgeKey,
    badgeLevel: badgeLevel ?? _badgeLevel,
    badgeName: badgeName ?? _badgeName,
    expireTime: expireTime ?? _expireTime,
    id: id ?? _id,
    use: use ?? _use,
    milestone: milestone ?? _milestone,
    notSelectUrl: notSelectUrl ?? _notSelectUrl,
    selectUrl: selectUrl ?? _selectUrl,
    type: type ?? _type,
    userId: userId ?? _userId,
  );

  String? get animationUrl => _animationUrl;

  String? get badgeKey => _badgeKey;

  num? get badgeLevel => _badgeLevel;

  bool? get use => _use;

  String? get badgeName => _badgeName;

  int? get expireTime => _expireTime;

  String? get id => _id;

  String? get milestone => _milestone;

  String? get notSelectUrl => _notSelectUrl;

  String? get selectUrl => _selectUrl;

  String? get type => _type;

  String? get userId => _userId;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['animationUrl'] = _animationUrl;
    map['badgeKey'] = _badgeKey;
    map['badgeLevel'] = _badgeLevel;
    map['badgeName'] = _badgeName;
    map['expireTime'] = _expireTime;
    map['id'] = _id;
    map['use'] = _use;
    map['milestone'] = _milestone;
    map['notSelectUrl'] = _notSelectUrl;
    map['selectUrl'] = _selectUrl;
    map['type'] = _type;
    map['userId'] = _userId;
    return map;
  }
}

class PersonPhoto {
  PersonPhoto({String? url, num? status}) {
    _url = url;
    _status = status;
  }

  PersonPhoto.fromJson(dynamic json) {
    _url = json['url'];
    _status = json['status'];
  }

  String? _url;
  num? _status;

  PersonPhoto copyWith({String? url, num? status}) =>
      PersonPhoto(url: url ?? _url, status: status ?? _status);

  String? get url => _url;

  num? get status => _status;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['url'] = _url;
    map['status'] = _status;
    return map;
  }
}

class CPRes {
  CPRes({
    String? meUserId,
    String? meAccount,
    String? meUserAvatar,
    String? meUserNickname,
    String? cpUserId,
    String? cpUserNickname,
    String? cpAccount,
    String? cpUserAvatar,
    String? days,
    String? firstDay,
    double? cpValue,
  }) {
    _meUserId = meUserId;
    _meAccount = meAccount;
    _meUserAvatar = meUserAvatar;
    _meUserNickname = meUserNickname;
    _cpUserId = cpUserId;
    _cpUserNickname = cpUserNickname;
    _cpAccount = cpAccount;
    _cpUserAvatar = cpUserAvatar;
    _days = days;
    _firstDay = firstDay;
    _cpValue = cpValue;
  }

  CPRes.fromJson(dynamic json) {
    _meUserId = json['meUserId'];
    _meAccount = json['meAccount'];
    _meUserAvatar = json['meUserAvatar'];
    _meUserNickname = json['meUserNickname'];
    _cpUserId = json['cpUserId'];
    _cpUserNickname = json['cpUserNickname'];
    _cpAccount = json['cpAccount'];
    _cpUserAvatar = json['cpUserAvatar'];
    _days = json['days'];
    _firstDay = json['firstDay'];
    _cpValue = json['cpValue'];
  }

  String? _meUserId;
  String? _meAccount;
  String? _meUserAvatar;
  String? _meUserNickname;
  String? _cpUserId;
  String? _cpUserNickname;
  String? _cpAccount;
  String? _cpUserAvatar;
  String? _days;
  String? _firstDay;
  double? _cpValue;

  String? get meUserId => _meUserId;

  String? get meAccount => _meAccount;

  String? get meUserAvatar => _meUserAvatar;

  String? get meUserNickname => _meUserNickname;

  String? get cpUserId => _cpUserId;

  String? get cpUserNickname => _cpUserNickname;

  String? get cpAccount => _cpAccount;

  String? get cpUserAvatar => _cpUserAvatar;

  String? get days => _days;

  String? get firstDay => _firstDay;

  double? get cpValue => _cpValue;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['meUserId'] = _meUserId;
    map['meAccount'] = _meAccount;
    map['meUserAvatar'] = _meUserAvatar;
    map['meUserNickname'] = _meUserNickname;
    map['cpUserId'] = _cpUserId;
    map['cpUserNickname'] = _cpUserNickname;
    map['cpAccount'] = _cpAccount;
    map['cpUserAvatar'] = _cpUserAvatar;
    map['days'] = _days;
    map['firstDay'] = _firstDay;
    map['cpValue'] = _cpValue;
    return map;
  }
}

/// expireTime : 0
/// propsResources : {"amount":0.0,"code":"","cover":"","expand":"","id":0,"name":"","sourceUrl":"","type":""}
/// userId : 0

class UseProps {
  UseProps({
    bool? allowGive,
    String? expireTime,
    PropsResources? propsResources,
    String? userId,
  }) {
    _allowGive = allowGive;
    _expireTime = expireTime;
    _propsResources = propsResources;
    _userId = userId;
  }

  UseProps.fromJson(dynamic json) {
    _allowGive = json['allowGive'];
    _expireTime = json['expireTime'];
    _propsResources =
        json['propsResources'] != null
            ? PropsResources.fromJson(json['propsResources'])
            : null;
    _userId = json['userId'];
  }

  bool? _allowGive;
  String? _expireTime;
  PropsResources? _propsResources;
  String? _userId;

  UseProps copyWith({
    bool? allowGive,
    String? expireTime,
    PropsResources? propsResources,
    String? userId,
  }) => UseProps(
    allowGive: allowGive ?? _allowGive,
    expireTime: expireTime ?? _expireTime,
    propsResources: propsResources ?? _propsResources,
    userId: userId ?? _userId,
  );

  bool? get allowGive => _allowGive;

  String? get expireTime => _expireTime;

  PropsResources? get propsResources => _propsResources;

  String? get userId => _userId;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['allowGive'] = _allowGive;
    map['expireTime'] = _expireTime;
    if (_propsResources != null) {
      map['propsResources'] = _propsResources?.toJson();
    }
    map['userId'] = _userId;
    return map;
  }

  void setPropsResources(PropsResources? pr) {
    _propsResources = pr;
  }
}

/// amount : 0.0
/// code : ""
/// cover : ""
/// expand : ""
/// id : 0
/// name : ""
/// sourceUrl : ""
/// type : ""

class PropsResources {
  PropsResources({
    num? amount,
    String? code,
    String? cover,
    num? createTime,
    bool? del,
    String? expand,
    String? id,
    String? imNotOpenedUrl,
    String? imOpenedUrl,
    String? imOpenedUrlTwo,
    String? imSendCoverUrl,
    String? name,
    String? roomNotOpenedUrl,
    String? roomOpenedUrl,
    String? roomSendCoverUrl,
    String? sourceUrl,
    String? sysOrigin,
    String? type,
    num? updateTime,
  }) {
    _amount = amount;
    _code = code;
    _cover = cover;
    _createTime = createTime;
    _del = del;
    _expand = expand;
    _id = id;
    _imNotOpenedUrl = imNotOpenedUrl;
    _imOpenedUrl = imOpenedUrl;
    _imOpenedUrlTwo = imOpenedUrlTwo;
    _imSendCoverUrl = imSendCoverUrl;
    _name = name;
    _roomNotOpenedUrl = roomNotOpenedUrl;
    _roomOpenedUrl = roomOpenedUrl;
    _roomSendCoverUrl = roomSendCoverUrl;
    _sourceUrl = sourceUrl;
    _sysOrigin = sysOrigin;
    _type = type;
    _updateTime = updateTime;
  }

  PropsResources.fromJson(dynamic json) {
    _amount = json['amount'];
    _code = json['code'];
    _cover = json['cover'];
    _createTime = json['createTime'];
    _del = json['del'];
    _expand = json['expand'];
    _id = json['id'];
    _imNotOpenedUrl = json['imNotOpenedUrl'];
    _imOpenedUrl = json['imOpenedUrl'];
    _imOpenedUrlTwo = json['imOpenedUrlTwo'];
    _imSendCoverUrl = json['imSendCoverUrl'];
    _name = json['name'];
    _roomNotOpenedUrl = json['roomNotOpenedUrl'];
    _roomOpenedUrl = json['roomOpenedUrl'];
    _roomSendCoverUrl = json['roomSendCoverUrl'];
    _sourceUrl = json['sourceUrl'];
    _sysOrigin = json['sysOrigin'];
    _type = json['type'];
    _updateTime = json['updateTime'];
  }

  num? _amount;
  String? _code;
  String? _cover;
  num? _createTime;
  bool? _del;
  String? _expand;
  String? _id;
  String? _imNotOpenedUrl;
  String? _imOpenedUrl;
  String? _imOpenedUrlTwo;
  String? _imSendCoverUrl;
  String? _name;
  String? _roomNotOpenedUrl;
  String? _roomOpenedUrl;
  String? _roomSendCoverUrl;
  String? _sourceUrl;
  String? _sysOrigin;
  String? _type;
  num? _updateTime;

  PropsResources copyWith({
    num? amount,
    String? code,
    String? cover,
    num? createTime,
    bool? del,
    String? expand,
    String? id,
    String? imNotOpenedUrl,
    String? imOpenedUrl,
    String? imOpenedUrlTwo,
    String? imSendCoverUrl,
    String? name,
    String? roomNotOpenedUrl,
    String? roomOpenedUrl,
    String? roomSendCoverUrl,
    String? sourceUrl,
    String? sysOrigin,
    String? type,
    num? updateTime,
  }) => PropsResources(
    amount: amount ?? _amount,
    code: code ?? _code,
    cover: cover ?? _cover,
    createTime: createTime ?? _createTime,
    del: del ?? _del,
    expand: expand ?? _expand,
    id: id ?? _id,
    imNotOpenedUrl: imNotOpenedUrl ?? _imNotOpenedUrl,
    imOpenedUrl: imOpenedUrl ?? _imOpenedUrl,
    imOpenedUrlTwo: imOpenedUrlTwo ?? _imOpenedUrlTwo,
    imSendCoverUrl: imSendCoverUrl ?? _imSendCoverUrl,
    name: name ?? _name,
    roomNotOpenedUrl: roomNotOpenedUrl ?? _roomNotOpenedUrl,
    roomOpenedUrl: roomOpenedUrl ?? _roomOpenedUrl,
    roomSendCoverUrl: roomSendCoverUrl ?? _roomSendCoverUrl,
    sourceUrl: sourceUrl ?? _sourceUrl,
    sysOrigin: sysOrigin ?? _sysOrigin,
    type: type ?? _type,
    updateTime: updateTime ?? _updateTime,
  );

  num? get amount => _amount;

  String? get code => _code;

  String? get cover => _cover;

  num? get createTime => _createTime;

  bool? get del => _del;

  String? get expand => _expand;

  String? get id => _id;

  String? get imNotOpenedUrl => _imNotOpenedUrl;

  String? get imOpenedUrl => _imOpenedUrl;

  String? get imOpenedUrlTwo => _imOpenedUrlTwo;

  String? get imSendCoverUrl => _imSendCoverUrl;

  String? get name => _name;

  String? get roomNotOpenedUrl => _roomNotOpenedUrl;

  String? get roomOpenedUrl => _roomOpenedUrl;

  String? get roomSendCoverUrl => _roomSendCoverUrl;

  String? get sourceUrl => _sourceUrl;

  String? get sysOrigin => _sysOrigin;

  String? get type => _type;

  num? get updateTime => _updateTime;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['amount'] = _amount;
    map['code'] = _code;
    map['cover'] = _cover;
    map['createTime'] = _createTime;
    map['del'] = _del;
    map['expand'] = _expand;
    map['id'] = _id;
    map['imNotOpenedUrl'] = _imNotOpenedUrl;
    map['imOpenedUrl'] = _imOpenedUrl;
    map['imOpenedUrlTwo'] = _imOpenedUrlTwo;
    map['imSendCoverUrl'] = _imSendCoverUrl;
    map['name'] = _name;
    map['roomNotOpenedUrl'] = _roomNotOpenedUrl;
    map['roomOpenedUrl'] = _roomOpenedUrl;
    map['roomSendCoverUrl'] = _roomSendCoverUrl;
    map['sourceUrl'] = _sourceUrl;
    map['sysOrigin'] = _sysOrigin;
    map['type'] = _type;
    map['updateTime'] = _updateTime;
    return map;
  }
}

/// account : ""
/// expiredTime : 0

class OwnSpecialId {
  OwnSpecialId({String? account, num? expiredTime}) {
    _account = account;
    _expiredTime = expiredTime;
  }

  OwnSpecialId.fromJson(dynamic json) {
    _account = json['account'];
    _expiredTime = json['expiredTime'];
  }

  String? _account;
  num? _expiredTime;

  OwnSpecialId copyWith({String? account, num? expiredTime}) => OwnSpecialId(
    account: account ?? _account,
    expiredTime: expiredTime ?? _expiredTime,
  );

  String? get account => _account;

  num? get expiredTime => _expiredTime;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['account'] = _account;
    map['expiredTime'] = _expiredTime;
    return map;
  }
}

/// expireTime : 0
/// releaseTime : 0
/// sign : ""
/// sysOrigin : ""
/// userId : 0
/// version : ""

class SocialChatUserCredential {
  SocialChatUserCredential({
    String? expireTime,
    String? releaseTime,
    String? sign,
    String? sysOrigin,
    String? userId,
    String? version,
  }) {
    _expireTime = expireTime;
    _releaseTime = releaseTime;
    _sign = sign;
    _sysOrigin = sysOrigin;
    _userId = userId;
    _version = version;
  }

  SocialChatUserCredential.fromJson(dynamic json) {
    _expireTime = json['expireTime'];
    _releaseTime = json['releaseTime'];
    _sign = json['sign'];
    _sysOrigin = json['sysOrigin'];
    _userId = json['userId'];
    _version = json['version'];
  }

  String? _expireTime;
  String? _releaseTime;
  String? _sign;
  String? _sysOrigin;
  String? _userId;
  String? _version;

  SocialChatUserCredential copyWith({
    String? expireTime,
    String? releaseTime,
    String? sign,
    String? sysOrigin,
    String? userId,
    String? version,
  }) => SocialChatUserCredential(
    expireTime: expireTime ?? _expireTime,
    releaseTime: releaseTime ?? _releaseTime,
    sign: sign ?? _sign,
    sysOrigin: sysOrigin ?? _sysOrigin,
    userId: userId ?? _userId,
    version: version ?? _version,
  );

  String? get expireTime => _expireTime;

  String? get releaseTime => _releaseTime;

  String? get sign => _sign;

  String? get sysOrigin => _sysOrigin;

  String? get userId => _userId;

  String? get version => _version;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['expireTime'] = _expireTime;
    map['releaseTime'] = _releaseTime;
    map['sign'] = _sign;
    map['sysOrigin'] = _sysOrigin;
    map['userId'] = _userId;
    map['version'] = _version;
    return map;
  }
}
