import { DetectionResult } from '../interfaces/palm-analysis.interface';

export const SCANNER_TOKEN = 'IScannerProvider';

export interface ScanResult {
  detections: DetectionResult[];
  raw_tensor_sample: number[][];
}

/** Minimal tensor shape used to thread tensors between provider stages. */
export interface InferenceTensor {
  data: Float32Array;
  dims: readonly number[];
}

export interface IScannerProvider {
  preprocess(imageBuffer: Buffer): Promise<InferenceTensor>;
  inference(tensor: InferenceTensor): Promise<InferenceTensor>;
  postprocess(
    tensor: InferenceTensor,
    originalWidth: number,
    originalHeight: number,
    threshold?: number,
  ): Promise<ScanResult>;
}
