import 'package:electronic_assistant/base/base_controller.dart';
import 'package:electronic_assistant/data/repositories/talk_repository.dart';
import 'package:electronic_assistant/utils/error_handler.dart';
import 'package:get/get.dart';

import '../../../data/api/response/talk_detail_response.dart';
import '../../../data/repositories/agenda_repository.dart';
import '../controller.dart';

class SummaryController extends BaseController {
  final TalkController talkController = Get.find();

  final talkInfo = TalkDetailResponse().obs;

  @override
  void onReady() {
    super.onReady();
    refreshSummaryData();
  }

  void refreshSummaryData() {
    String? id = talkController.talkBean.value.id;
    if (id == null) {
      return;
    }
    talkRepository.talkInfo(id).then((info) {
      talkInfo.value = info;
    }).catchError((e) {
      ErrorHandler.toastError(e);
    });
    agendaRepository.agendaListAll(id).then((agenda) {});
  }
}
