import 'package:fis_common/event/event_type.dart';

/// 检查信息
class ExamInfo {
  int _selectedImageIndex = -1;

  /// 检查编号
  final String code;

  /// 检查图像集合
  List<ExamImageInfo> images = [];

  ExamInfo(this.code);

  /// 选中图像索引
  int get selectedImageIndex => _selectedImageIndex;
  set selectedImageIndex(int value) {
    if (value != _selectedImageIndex) {
      _selectedImageIndex = value;
      selectedImageChanged.emit(this, value);
    }
  }

  /// 当前选中图像
  ExamImageInfo get selectedImage => images[selectedImageIndex];

  /// 图像选中变化事件
  final selectedImageChanged = FEventHandler<int>();
}

/// 检查图像信息
class ExamImageInfo {
  /// 图像文件链接
  final String url;

  /// 预览图链接
  final String previewUrl;

  ExamImageInfo(this.url, this.previewUrl);
}
