import 'package:yumi/shared/business_logic/models/res/room_res.dart';

import 'join_room_res.dart' show RoomCounter;

/// id : 0
/// roomAccount : ""
/// userId : 0
/// roomCover : ""
/// roomName : ""
/// roomDesc : ""
/// event : ""
/// sysOrigin : ""
/// countryCode : ""
/// countryName : ""
/// nationalFlag : ""
/// langCode : ""
/// del : false
/// createTime : 0
/// updateTime : 0
/// activeTime : 0
/// setting : {"password":"","takeMicRole":"","touristMike":false,"touristMsg":false,"maxMember":0,"maxAdmin":0,"joinGolds":0,"mikeSize":0,"allowMusic":false,"adminLockSeat":false,"showHeartbeat":false,"roomSpecialMikeType":"","roomSpecialMikeExpireTime":0,"roomSpecialMikeExpireType":""}
/// counter : {"memberCount":0,"adminCount":0}
/// customizeSetting : {"":""}
/// useBadges : [{"id":0,"userId":0,"badgeLevel":0,"milestone":0,"badgeName":"","type":"","badgeKey":"","selectUrl":"","notSelectUrl":"","animationUrl":"","expireTime":0}]

class MyRoomRes {
  MyRoomRes({
    String? id,
    String? roomAccount,
    String? userId,
    String? roomCover,
    String? roomName,
    String? roomDesc,
    String? event,
    String? sysOrigin,
    String? countryCode,
    String? countryName,
    String? nationalFlag,
    String? langCode,
    bool? del,
    num? createTime,
    num? updateTime,
    num? activeTime,
    RoomSetting? setting,
    RoomCounter? counter,
    List<UseBadges>? useBadges,
  }) {
    _id = id;
    _roomAccount = roomAccount;
    _userId = userId;
    _roomCover = roomCover;
    _roomName = roomName;
    _roomDesc = roomDesc;
    _event = event;
    _sysOrigin = sysOrigin;
    _countryCode = countryCode;
    _countryName = countryName;
    _nationalFlag = nationalFlag;
    _langCode = langCode;
    _del = del;
    _createTime = createTime;
    _updateTime = updateTime;
    _activeTime = activeTime;
    _setting = setting;
    _counter = counter;
    _useBadges = useBadges;
  }

  MyRoomRes.fromJson(dynamic json) {
    _id = json['id'];
    _roomAccount = json['roomAccount'];
    _userId = json['userId'];
    _roomCover = json['roomCover'] ?? json['cover'];
    _roomName = json['roomName'];
    _roomDesc = json['roomDesc'];
    _event = json['event'];
    _sysOrigin = json['sysOrigin'];
    _countryCode = json['countryCode'];
    _countryName = json['countryName'];
    _nationalFlag = json['nationalFlag'];
    _langCode = json['langCode'];
    _del = json['del'];
    _createTime = json['createTime'];
    _updateTime = json['updateTime'];
    _activeTime = json['activeTime'];
    _setting =
        json['setting'] != null ? RoomSetting.fromJson(json['setting']) : null;
    _counter =
        json['counter'] != null ? RoomCounter.fromJson(json['counter']) : null;
    if (json['useBadges'] != null) {
      _useBadges = [];
      json['useBadges'].forEach((v) {
        _useBadges?.add(UseBadges.fromJson(v));
      });
    }
  }
  String? _id;
  String? _roomAccount;
  String? _userId;
  String? _roomCover;
  String? _roomName;
  String? _roomDesc;
  String? _event;
  String? _sysOrigin;
  String? _countryCode;
  String? _countryName;
  String? _nationalFlag;
  String? _langCode;
  bool? _del;
  num? _createTime;
  num? _updateTime;
  num? _activeTime;
  RoomSetting? _setting;
  RoomCounter? _counter;
  List<UseBadges>? _useBadges;
  MyRoomRes copyWith({
    String? id,
    String? roomAccount,
    String? userId,
    String? roomCover,
    String? roomName,
    String? roomDesc,
    String? event,
    String? sysOrigin,
    String? countryCode,
    String? countryName,
    String? nationalFlag,
    String? langCode,
    bool? del,
    num? createTime,
    num? updateTime,
    num? activeTime,
    RoomSetting? setting,
    RoomCounter? counter,
    List<UseBadges>? useBadges,
  }) => MyRoomRes(
    id: id ?? _id,
    roomAccount: roomAccount ?? _roomAccount,
    userId: userId ?? _userId,
    roomCover: roomCover ?? _roomCover,
    roomName: roomName ?? _roomName,
    roomDesc: roomDesc ?? _roomDesc,
    event: event ?? _event,
    sysOrigin: sysOrigin ?? _sysOrigin,
    countryCode: countryCode ?? _countryCode,
    countryName: countryName ?? _countryName,
    nationalFlag: nationalFlag ?? _nationalFlag,
    langCode: langCode ?? _langCode,
    del: del ?? _del,
    createTime: createTime ?? _createTime,
    updateTime: updateTime ?? _updateTime,
    activeTime: activeTime ?? _activeTime,
    setting: setting ?? _setting,
    counter: counter ?? _counter,
    useBadges: useBadges ?? _useBadges,
  );
  String? get id => _id;
  String? get roomAccount => _roomAccount;
  String? get userId => _userId;
  String? get roomCover => _roomCover;
  String? get roomName => _roomName;
  String? get roomDesc => _roomDesc;
  String? get event => _event;
  String? get sysOrigin => _sysOrigin;
  String? get countryCode => _countryCode;
  String? get countryName => _countryName;
  String? get nationalFlag => _nationalFlag;
  String? get langCode => _langCode;
  bool? get del => _del;
  num? get createTime => _createTime;
  num? get updateTime => _updateTime;
  num? get activeTime => _activeTime;
  RoomSetting? get setting => _setting;
  RoomCounter? get counter => _counter;
  List<UseBadges>? get useBadges => _useBadges;
  set setRoomCover(String value) => _roomCover = value;
  set setRoomName(String value) => _roomName = value;
  set setRoomDesc(String value) => _roomDesc = value;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = _id;
    map['roomAccount'] = _roomAccount;
    map['userId'] = _userId;
    map['roomCover'] = _roomCover;
    map['roomName'] = _roomName;
    map['roomDesc'] = _roomDesc;
    map['event'] = _event;
    map['sysOrigin'] = _sysOrigin;
    map['countryCode'] = _countryCode;
    map['countryName'] = _countryName;
    map['nationalFlag'] = _nationalFlag;
    map['langCode'] = _langCode;
    map['del'] = _del;
    map['createTime'] = _createTime;
    map['updateTime'] = _updateTime;
    map['activeTime'] = _activeTime;
    if (_setting != null) {
      map['setting'] = _setting?.toJson();
    }
    if (_counter != null) {
      map['counter'] = _counter?.toJson();
    }
    if (_useBadges != null) {
      map['useBadges'] = _useBadges?.map((v) => v.toJson()).toList();
    }
    return map;
  }
}

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

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

  UseBadges.fromJson(dynamic json) {
    _id = json['id'];
    _userId = json['userId'];
    _badgeLevel = json['badgeLevel'];
    _milestone = json['milestone'];
    _badgeName = json['badgeName'];
    _type = json['type'];
    _badgeKey = json['badgeKey'];
    _selectUrl = json['selectUrl'];
    _notSelectUrl = json['notSelectUrl'];
    _animationUrl = json['animationUrl'];
    _expireTime = json['expireTime'];
  }
  num? _id;
  num? _userId;
  num? _badgeLevel;
  num? _milestone;
  String? _badgeName;
  String? _type;
  String? _badgeKey;
  String? _selectUrl;
  String? _notSelectUrl;
  String? _animationUrl;
  String? _expireTime;
  UseBadges copyWith({
    num? id,
    num? userId,
    num? badgeLevel,
    num? milestone,
    String? badgeName,
    String? type,
    String? badgeKey,
    String? selectUrl,
    String? notSelectUrl,
    String? animationUrl,
    String? expireTime,
  }) => UseBadges(
    id: id ?? _id,
    userId: userId ?? _userId,
    badgeLevel: badgeLevel ?? _badgeLevel,
    milestone: milestone ?? _milestone,
    badgeName: badgeName ?? _badgeName,
    type: type ?? _type,
    badgeKey: badgeKey ?? _badgeKey,
    selectUrl: selectUrl ?? _selectUrl,
    notSelectUrl: notSelectUrl ?? _notSelectUrl,
    animationUrl: animationUrl ?? _animationUrl,
    expireTime: expireTime ?? _expireTime,
  );
  num? get id => _id;
  num? get userId => _userId;
  num? get badgeLevel => _badgeLevel;
  num? get milestone => _milestone;
  String? get badgeName => _badgeName;
  String? get type => _type;
  String? get badgeKey => _badgeKey;
  String? get selectUrl => _selectUrl;
  String? get notSelectUrl => _notSelectUrl;
  String? get animationUrl => _animationUrl;
  String? get expireTime => _expireTime;

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