/// YApi QuickType插件生成，具体参考文档:https://plugins.jetbrains.com/plugin/18847-yapi-quicktype/documentation

import 'dart:convert';
import 'package:domain/entity/rewards_active_detail_entity.dart';
import 'package:domain/entity/rewards_detail_entity.dart';
import 'package:domain/entity/rewards_my_detail_entity.dart';
import 'package:widgets/load_state_layout.dart';

class RewardsRedeemState {
  //页面 LoadView 状态的展示
  LoadState loadingState;
  String? errorMessage;
  RewardsMyDetailEntity? detail;
  RewardsRedeemState({
    this.loadingState = LoadState.State_Loading,
    String? errorMessage,
    RewardsMyDetailEntity? detail,
  }) : detail = detail ?? RewardsMyDetailEntity();

  RewardsRedeemState copyWith({
    LoadState? loadingState,
    String? errorMessage,
    RewardsMyDetailEntity? detail,
  }) {
    return RewardsRedeemState(
      loadingState: loadingState ?? this.loadingState,
      errorMessage: errorMessage ?? this.errorMessage,
      detail: detail ?? this.detail,
    );
  }

  Map<String, dynamic> toMap() {
    return {
      'loadingState': this.loadingState,
      'errorMessage': this.errorMessage,
      'detail': this.detail,
    };
  }

  factory RewardsRedeemState.fromMap(Map<String, dynamic> map) {
    return RewardsRedeemState(
      loadingState: map['loadingState'] as LoadState,
      errorMessage: map['errorMessage'] as String,
      detail: map['detail'] as RewardsMyDetailEntity,
    );
  }
}
