import 'dart:core';

import 'package:fis_jsonrpc/client_base.dart';
import 'package:fis_common/json_convert.dart';

import 'identityApply.m.dart';

import 'liveConsultation.m.dart';


class IdentityApplyService extends JsonRpcClientBase {
	IdentityApplyService(
		String host, {
		String serviceName = "IIdentityApplyService",
		Map<String, String>? headers,
		int? timeout,
	}) : super(
						host,
						serviceName,
						headers: headers,
						timeout: timeout,
				) {
		/// 注册响应实体反序列化处理器
		FJsonConvert.setDecoder((map) => IdentityApplyDTO.fromJson(map));
	}

	Future<List<IdentityApplyDTO>> getIdentityApplysAsync(TokenRequest request) async {
		var rpcRst = await call("GetIdentityApplysAsync", request);
		var result = (rpcRst as List).map((e)=>IdentityApplyDTO.fromJson(e as Map<String, dynamic>)).toList();
		return result;
	}

	Future<IdentityApplyDTO> getLastIdentityApplyAsync(GetLastIdentityApplyRequest request) async {
		var rpcRst = await call("GetLastIdentityApplyAsync", request);
		var result = IdentityApplyDTO.fromJson(rpcRst as Map<String, dynamic>);
		return result;
	}

	Future<bool> applyForAsync(ApplyForRequest request) async {
		var rpcRst = await call("ApplyForAsync", request);
		return rpcRst;
	}

}