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

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

class BagsListRes {
  BagsListRes({
    String? userId,
    String? type,
    int? expireTime,
    bool? useProps,
    PropsResources? propsResources,
    bool? allowGive,
  }) {
    _userId = userId;
    _type = type;
    _expireTime = expireTime;
    _useProps = useProps;
    _propsResources = propsResources;
    _allowGive = allowGive;
  }

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

  String? _userId;
  String? _type;
  int? _expireTime;
  bool? _useProps;
  PropsResources? _propsResources;
  bool? _allowGive;

  BagsListRes copyWith({
    String? userId,
    String? type,
    int? expireTime,
    bool? useProps,
    PropsResources? propsResources,
    bool? allowGive,
  }) => BagsListRes(
    userId: userId ?? _userId,
    type: type ?? _type,
    expireTime: expireTime ?? _expireTime,
    useProps: useProps ?? _useProps,
    propsResources: propsResources ?? _propsResources,
    allowGive: allowGive ?? _allowGive,
  );

  String? get userId => _userId;

  String? get type => _type;

  int? get expireTime => _expireTime;

  bool? get useProps => _useProps;

  PropsResources? get propsResources => _propsResources;

  bool? get allowGive => _allowGive;

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