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

import 'dart:convert';
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 RewardsTransactionState {
  //页面 LoadView 状态的展示
  LoadState loadingState;
  String? errorMessage;
  RewardsMyDetailEntity? detailInfo;

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

  RewardsTransactionState copyWith({
    LoadState? loadingState,
    String? errorMessage,
    RewardsMyDetailEntity? detailInfo,
  }) {
    return RewardsTransactionState(
      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 RewardsTransactionState.fromMap(Map<String, dynamic> map) {
    return RewardsTransactionState(
      loadingState: map['loadingState'] as LoadState,
      errorMessage: map['errorMessage'] as String,
      detailInfo: map['detailInfo'] as RewardsMyDetailEntity,
    );
  }
}
