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

import 'dart:convert';

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

class RewardsDetailState {
  //页面 LoadView 状态的展示
  LoadState loadingState;
  String? errorMessage;
  RewardsDetailEntity? detailInfo;

  RewardsDetailState({
    this.loadingState = LoadState.State_Loading,
    String? errorMessage,
    RewardsDetailEntity? detailInfo,
  }) : detailInfo = detailInfo ?? RewardsDetailEntity();

  RewardsDetailState copyWith({
    LoadState? loadingState,
    String? errorMessage,
    RewardsDetailEntity? detailInfo,
  }) {
    return RewardsDetailState(
      loadingState: loadingState ?? this.loadingState,
      errorMessage: errorMessage ?? this.errorMessage,
      detailInfo: detailInfo ?? this.detailInfo,
    );
  }

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

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