import { Queue } from '@monkvision/common'; import { MonkApiConfig } from '@monkvision/network'; import { PhotoCaptureAppConfig, ComplianceOptions, MonkPicture, TaskName, VehiclePart } from '@monkvision/types'; import { CaptureMode } from '../types'; /** * Payload for the onUploadSuccess event handler. */ export interface UploadSuccessPayload { /** * The total elapsed time in milliseconds between the start of the upload and the end of the upload. */ durationMs?: number; /** * The sight ID associated with the uploaded picture, if applicable. */ sightId?: string; /** * The ID of the uploaded image. */ imageId?: string; } /** * Type definition for upload event handlers. */ export interface UploadEventHandlers { /** * Callback called when a picture upload successfully completes. */ onUploadSuccess?: (payload: UploadSuccessPayload) => void; /** * Callback called when a picture upload fails because of a timeout. */ onUploadTimeout?: () => void; } /** * Parameters of the useUploadQueue hook. */ export interface UploadQueueParams extends Pick { /** * The inspection ID. */ inspectionId: string; /** * The api config used to communicate with the API. */ apiConfig: MonkApiConfig; /** * The options for the compliance conf */ complianceOptions: ComplianceOptions; /** * A collection of event handlers listening to upload events. */ eventHandlers?: UploadEventHandlers[]; } /** * Upload options for a normal sight picture. */ export interface SightPictureUpload { /** * Upload mode : `PhotoCaptureMode.SIGHT`. */ mode: CaptureMode.SIGHT; /** * The picture to upload. */ picture: MonkPicture; /** * The ID of the sight of the picture uploaded. */ sightId: string; /** * The tasks to run for the given sight. */ tasks: TaskName[]; } /** * Upload options for the first picture of a 2-shot add damage process. */ export interface AddDamage1stShotPictureUpload { /** * Upload mode : `PhotoCaptureMode.ADD_DAMAGE_1ST_SHOT`. */ mode: CaptureMode.ADD_DAMAGE_1ST_SHOT; /** * The picture to upload. */ picture: MonkPicture; } /** * Upload options for the second picture of a 2-shot add damage process. */ export interface AddDamage2ndShotPictureUpload { /** * Upload mode : `PhotoCaptureMode.ADD_DAMAGE_2ND_SHOT`. */ mode: CaptureMode.ADD_DAMAGE_2ND_SHOT; /** * The picture to upload. */ picture: MonkPicture; } /** * Upload options for a part select picture in the add damage process. */ export interface AddDamagePartSelectShotPictureUpload { /** * Upload mode : `PhotoCaptureMode.ADD_DAMAGE_PART_SELECTION`. */ mode: CaptureMode.ADD_DAMAGE_PART_SELECT_SHOT; /** * The picture to upload. */ picture: MonkPicture; /** * Selected damaged parts. */ vehicleParts: VehiclePart[]; } /** * Union type describing every possible upload configurations for a picture taken. */ export type PictureUpload = SightPictureUpload | AddDamage1stShotPictureUpload | AddDamage2ndShotPictureUpload | AddDamagePartSelectShotPictureUpload; /** * Custom hook used to generate the UploadQueue (using the `useQueue` hook) for the PhotoCapture component. */ export declare function useUploadQueue({ inspectionId, apiConfig, additionalTasks, complianceOptions, eventHandlers, }: UploadQueueParams): Queue;