import 'package:rasadyar_core/core.dart';

Future<XFile?> pickCameraImage({
  double? maxWidth,
  double? maxHeight,
  int? imageQuality,
  CameraDevice preferredCameraDevice = CameraDevice.rear,
  bool requestFullMetadata = true,
}) async {
  ImagePicker picker = diCore<ImagePicker>();
  var tmpImage = await picker.pickImage(
    source: ImageSource.camera,
    imageQuality: imageQuality ?? 90,
    preferredCameraDevice: CameraDevice.front,
    maxHeight: maxHeight,
    maxWidth: maxWidth,
  );

  getFileSizeInKB(tmpImage?.path ?? '', tag: 'Picked');

  return tmpImage;
}

Future<XFile?> pickGalleryImage({
  double? maxWidth,
  double? maxHeight,
  int? imageQuality,
  CameraDevice preferredCameraDevice = CameraDevice.rear,
  bool requestFullMetadata = true,
}) async {
  ImagePicker picker = diCore<ImagePicker>();
  var tmpImage = await picker.pickImage(
    source: ImageSource.gallery,
    imageQuality: imageQuality ?? 90,
    preferredCameraDevice: CameraDevice.front,
    maxHeight: maxHeight,
    maxWidth: maxWidth,
  );

  getFileSizeInKB(tmpImage?.path ?? '', tag: 'Picked');

  return tmpImage;
}
