/// 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 RewardsConfirmState {
  //页面 LoadView 状态的展示
  LoadState loadingState;
  String? errorMessage;
  RewardsDetailEntity? detailInfo;
  int? number=1;
  int? amount=0;

  RewardsConfirmState({
    this.loadingState = LoadState.State_Loading,
    String? errorMessage,
    this.number = 1,
    this.amount = 0,
    RewardsDetailEntity? detailInfo,
  }) : detailInfo = detailInfo ?? RewardsDetailEntity();

  RewardsConfirmState copyWith({
    LoadState? loadingState,
    String? errorMessage,
    int? number,
    int? amount,
    RewardsDetailEntity? detailInfo,
  }) {
    return RewardsConfirmState(
      loadingState: loadingState ?? this.loadingState,
      errorMessage: errorMessage ?? this.errorMessage,
      number: number ?? this.number,
      amount: amount ?? this.amount,
      detailInfo: detailInfo ?? this.detailInfo,
    );
  }

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

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