import 'package:fis_jsonrpc/rpc.dart';
import 'package:flyinsono/architecture/router/index.dart';
import 'package:flyinsono/architecture/states/states.dart';
import 'package:flyinsono/js_platform/methods.dart';
import 'package:flyinsono/managers/interfaces/user_info.dart';
import 'package:get/get.dart';

import 'base.dart';

class OpenLiveConsultationHandler extends MethodHandlerBase {
  OpenLiveConsultationHandler() : super(TargetMethodName.OpenLiveConsultation);
  final manager = Get.find<IUserInfoManager>();
  @override
  Future<void> execute(List<String> args) async {
    String token = args[0];
    Store.user.setToken(token);
    await manager.getUserInfoAsync();
    Store.user.initNotificationConfig(type: WSType.Consultation);
    router.to(
      RouteNames.RealTimeRemedical.LiveConsultation,
      parameters: {
        "consultationCode": args[1],
        "isJoin": args[2],
        "pageIndex": args[3],
      },
    );
  }
}
