//
//  DAImage.h
//
//  Copyright © 2024 Jumio Corporation. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreMedia/CoreMedia.h>
#import "Common.h"
#import "JDAEventAttribute.h"

NS_ASSUME_NONNULL_BEGIN

/// Clockwise angles matching CameraCharacteristics.SENSOR_ORIENTATION on Android
typedef NS_ENUM(int, JDAImageRotation) {
    JDAImageRotationUpRight = 0,
    JDAImageRotationHorizontalRight = 90,
    JDAImageRotationUpsideDown = 180,
    JDAImageRotationHorizontalLeft = 270,
} NS_SWIFT_NAME(JDAImage.Rotation);

typedef NS_ENUM(int, JDAImageFormat) {
    JDAImageFormatBGRA,
    JDAImageFormatDepthFloat32,
    JDAImageFormatDepthFloat16,
    JDAImageFormatDisparityFloat32,
    JDAImageFormatDisparityFloat16,
} NS_SWIFT_NAME(JDAImage.Format);

JDACLIENT_EXPORT @interface JDAImage : NSObject

@property (readonly, nonatomic) NSData* data;
@property (readonly, nonatomic) int width;
@property (readonly, nonatomic) int height;
@property (readonly, nonatomic) JDAImageRotation rotation;
@property (readonly, nonatomic) JDAImageFormat format;
@property (readonly, nonatomic) NSArray<JDAEventAttribute*>* attributes;

@property (readonly, nonatomic) BOOL isDepthFormat;

@property (readonly, nonatomic) int iso DEPRECATED_MSG_ATTRIBUTE("No longer set. This will be 0 at all time. ");

- (instancetype)init NS_UNAVAILABLE;
- (instancetype _Nullable)initWithImageSampleBuffer:(CMSampleBufferRef)sampleBuffer;
- (instancetype _Nullable)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer exifAttachments:(NSDictionary*)exifAttachments;
- (instancetype)initWithData:(NSData*)data width:(int)width height:(int)height rotation:(JDAImageRotation)rotation format:(JDAImageFormat)format exifAttachments:(NSDictionary*)exifAttachments NS_DESIGNATED_INITIALIZER;

- (instancetype _Nullable)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer iso:(int)iso DEPRECATED_MSG_ATTRIBUTE("Use the initializer that accepts exifAttachments instead.");
- (instancetype)initWithData:(NSData*)data width:(int)width height:(int)height rotation:(JDAImageRotation)rotation format:(JDAImageFormat)format iso:(int)iso DEPRECATED_MSG_ATTRIBUTE("Use the initializer that accepts exifAttachments instead.");

@end

NS_ASSUME_NONNULL_END
