import 'package:clean/base/base_controller.dart';
import 'package:clean/base/base_photo_controller.dart';
import 'package:clean/data/bean/photos_type.dart';
import 'package:clean/module/image_picker/image_picker_util.dart';
import 'package:clean/module/people_photo/photo_group.dart';
import 'package:clean/module/photo_preview/photo_preview_view.dart';
import 'package:clean/utils/toast_util.dart';
import 'package:get/get.dart';
import 'package:wechat_assets_picker/wechat_assets_picker.dart';

class PeoplePhotoController extends BasePhotoController {
  @override
  void loadPhotos() {
    // 清空现有数据
    photoGroups.clear();
    final photoGroup = ImagePickerUtil.peoplePhotos;
    if (photoGroup.isNotEmpty) {
      photoGroups.add(PhotoGroup(
        isSelected: false,
        images: photoGroup,
      ));
    }
    print('PeoplePhotoController loadPhotos ImagePickerUtil.selectedPeoplePhotosIds ${ImagePickerUtil.selectedPeoplePhotosIds}');
    selectedPhotosIds.assignAll(ImagePickerUtil.selectedPeoplePhotosIds);
  }

  @override
  PhotosType getPhotosType() => PhotosType.peoplePhotos;

  void clickBack() {
    print('PeoplePhotoController clickBack selectedPhotosIds $selectedPhotosIds');
    updateSelections(selectedPhotosIds); // 恢复选中状态

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