import 'package:cpt_uk/modules/job/job_list/job_list_page.dart';
import 'package:cpt_uk/modules/job/labour_request_list/labour_request_list_page.dart';
import 'package:cpt_uk/modules/job/template_list/template_list_page.dart';
import 'package:domain/entity/home_module.dart';
import 'package:get/get.dart';
import 'package:plugin_platform/http/dio/dio_cancelable_mixin.dart';
import 'package:widgets/widget_export.dart';
import '../../review/attendance_review_list/attendance_review_page.dart';
import '../../review/labour_review_list/labour_review_page.dart';
import 'job_category_state.dart';

/*
 * 工作相关的子模块分类列表
 */
class JobCategoryController extends GetxController with DioCancelableMixin {
  final JobCategoryState state = JobCategoryState();

  // Refresh 控制器
  final EasyRefreshController refreshController = EasyRefreshController(
    controlFinishRefresh: false,
    controlFinishLoad: false,
  );

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

  /// 跳转到指定的模块中去
  void gotoModulePage(HomeModule module) {
    switch (module.key) {
      case 'job_template':
        UKTemplateListPage.startInstance();
        break;
      case 'labour_request':
        UKLabourRequestListPage.startInstance();
        break;
      case 'lab_review':
        UKLabourReviewPage.startInstance();
        break;
      case 'job_list':
        UKJobListPage.startInstance();
        break;
      case 'attendance_review':
        UKAttendanceReviewPage.startInstance();
        break;
    }
  }

  @override
  void onClose() {
    state.datas.clear();
    super.onClose();
  }
}
