/*
 * This is one of the header files of Dynamsoft Capture Vision SDK - Label Recognizer module.
 *
 * Copyright © Dynamsoft Corporation.  All rights reserved.
 */

#import <Foundation/Foundation.h>
#import <DynamsoftCaptureVisionBundle/DSIntermediateResultUnit.h>

@class DSLocalizedTextLineElement;
@class DSAuxiliaryRegionElement;

NS_ASSUME_NONNULL_BEGIN

/**
 * DSLocalizedTextLinesUnit class represents a unit that contains localized text lines. It inherits from the DSIntermediateResultUnit class.
 */
NS_SWIFT_NAME(LocalizedTextLinesUnit)
@interface DSLocalizedTextLinesUnit : DSIntermediateResultUnit

- (NSInteger)getCount;

- (nullable NSArray<DSLocalizedTextLineElement *> *)getLocalizedTextLines;

/**
 * Get the localized text line by specifying the index.
 * @param index The index of the localized text line.
 * @return The specified localized text line.
 */
- (nullable DSLocalizedTextLineElement *)getLocalizedTextLine:(NSInteger)index;

/**
 * Add a user define LocalizedTextLineElement as the localized text line. A transformation matrix is included to transfer the coordinate base to the original image.
 * @param element A DSLocalizedTextLineElement object defines the localized text line to set.
 * @param matrixToOriginalImage The transformation matrix that transfer the coordinate base to the original image.
 * @return Return the error code if an error occurs.
 */
- (NSInteger)setLocalizedTextLine:(NSInteger)index
                          element:(DSLocalizedTextLineElement *)element
            matrixToOriginalImage:(CGAffineTransform)matrixToOriginalImage;

/**
 * Add a user define LocalizedTextLineElement as the localized text line. A transformation matrix is included to transfer the coordinate base to the original image.
 * @param element A DSLocalizedTextLineElement object defines the localized text line to add.
 * @param matrixToOriginalImage The transformation matrix that transfer the coordinate base to the original image.
 * @return Return the error code if an error occurs.
 */
- (NSInteger)addLocalizedTextLine:(DSLocalizedTextLineElement *)element
            matrixToOriginalImage:(CGAffineTransform)matrixToOriginalImage;

/**
 * Remove all the localized text lines.
 */
- (void)removeAllLocalizedTextLines;

/**
 * Remove the localized text line by specifying the index.
 * @param index The index of the localized text line to remove.
 * @return Return the error code if an error occurs.
 */
- (NSInteger)removeLocalizedTextLine:(NSInteger)index;

/**
 * Gets the count of auxiliary region elements in this unit.
 *
 * @return The number of auxiliary region elements.
 */
- (NSInteger)getAuxiliaryRegionElementsCount;

/**
 * Gets all auxiliary region elements in this unit.
 *
 * @return A NSArray containing all auxiliary region elements.
 */
- (nullable NSArray<DSAuxiliaryRegionElement *>*)getAuxiliaryRegionElements;

/**
 * Gets the auxiliary region element at the specified index.
 *
 * @param index The zero-based index of the auxiliary region element to retrieve.
 * @return A pointer to the CAuxiliaryRegionElement object, or NULL if the index is out of range.
 */
- (nullable DSAuxiliaryRegionElement *)getAuxiliaryRegionElement:(NSInteger)index;

/**
 * Sets or replaces the auxiliary region element at the specified index.
 *
 * @param index The zero-based index where the element should be set.
 * @param element The auxiliary region element to set.
 * @param matrixToOriginalImage The transformation matrix from the current image to the original image.
 * @return Returns 0 if successful, otherwise returns an error code.
 */
- (NSInteger)setAuxiliaryRegionElement:(NSInteger)index
                               element:(DSAuxiliaryRegionElement *)element
                 matrixToOriginalImage:(CGAffineTransform)matrixToOriginalImage;

/**
 * Adds a new auxiliary region element to this unit.
 *
 * @param element The auxiliary region element to add.
 * @param matrixToOriginalImage The transformation matrix from the current image to the original image.
 * @return Returns 0 if successful, otherwise returns an error code.
 */
- (NSInteger)addAuxiliaryRegionElement:(DSAuxiliaryRegionElement*)element
                 matrixToOriginalImage:(CGAffineTransform)matrixToOriginalImage
NS_SWIFT_NAME(addAuxiliaryRegionElement(_:matrixToOriginalImage:));

/**
 * Removes the auxiliary region element at the specified index.
 *
 * @param index The zero-based index of the auxiliary region element to remove.
 * @return Returns 0 if successful, otherwise returns an error code.
 */
- (NSInteger)removeAuxiliaryRegionElement:(NSInteger)index;

/**
 * Removes all auxiliary region elements from this unit.
 */
- (void)removeAllAuxiliaryRegionElements;

+ (instancetype)new NS_UNAVAILABLE;

- (instancetype)init NS_UNAVAILABLE;

@end

NS_ASSUME_NONNULL_END
