/*
 * @Author: XianKaiQun
 * @Date: 2020-08-17 09:52:07
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-10-28 17:43:04
 * @Description: 
 */
import 'package:app_package/app_package.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:receipt_package/src/impl/receipt_service_impl.dart';
import 'package:receipt_package/src/models/deposit_asset_detail.dart';

class PrivatePledgeDetailStore with ChangeNotifier {
  final BuildContext context, providerContext;
  late Map<String, dynamic> routingArgs;
  PrivatePledgeDetailStore(this.context, this.providerContext) {
    routingArgs = (ModalRoute.of(context)?.settings.arguments ??
            new Map<String, dynamic>()) as Map<String, dynamic>? ??
        {};
  }

  final communityGlobalStore = GetIt.I.get<CommunityGlobalStore>();

  String? get communityId => communityGlobalStore.data?.id;

  DepositAssetDetailModel? data;

  Future getData() async {
    final res = await ReceiptServiceImpl().getPackDepositAssetDetail({
      'communityId': communityId,
      'assetId': routingArgs['assetId'],
      'chargeSubject': routingArgs['assetType'],
    });
    data = res.data ?? DepositAssetDetailModel();
    notifyListeners();
  }
}
