import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';

class ActionLogic extends GetxController with GetTickerProviderStateMixin {
  late Rx<SlidableController> slidController;
  bool showSlideHint = true;

  RxInt selectedIndex = 0.obs;
  RxInt previousIndex = 0.obs;

  List<String> headersTitle = [
    'کاربران',
    'سوابق',
    'آمار',
  ];

  List<String> headersIcons = [
    Assets.vec.profileUserSvg.path,
    Assets.vec.calendarSearchSvg.path,
    Assets.vec.diagramSvg.path,
  ];

  RxList<bool> supervisionHistoryList = [false, false, false, false].obs;

  List<String> tmpLs = ['دولتی', 'غیر دولتی', 'استیجاری', 'شخصی', 'سایر'];

  List<String> hamadanCities = [
    'همدان',
    'ملایر',
    'نهاوند',
    'تویسرکان',
    'اسدآباد',
    'بهار',
    'رزن',
    'کبودرآهنگ',
    'فامنین',
    'لالجین',
  ];

  RxInt filter1Index = 0.obs;
  RxInt filter2Index = 0.obs;

  @override
  void onInit() {
    super.onInit();
    slidController = SlidableController(this).obs;
  }

  @override
  void onReady() {
    // TODO: implement onReady
    super.onReady();
  }

  @override
  void onClose() {
    // TODO: implement onClose
    super.onClose();
  }

  Future<void> triggerSlidableAnimation() async {
    await Future.delayed(Duration(milliseconds: 200));
    await slidController.value.openEndActionPane();
    await Future.delayed(Duration(milliseconds: 200));
    await slidController.value.close();
    showSlideHint = !showSlideHint;
  }

  void updateSelectedIndex(int index) {
    if (index == selectedIndex.value) {
      return;
    }
    previousIndex.value = selectedIndex.value;
    selectedIndex.value = index;
  }
}
