package com.performancecoachlab.posedetection.recording

import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.graphics.ImageBitmap
import com.performancecoachlab.posedetection.custom.ObjectModel
import com.performancecoachlab.posedetection.skeleton.Skeleton

expect class InputFrame {
    fun toImageBitmap(): ImageBitmap
    fun drawSkeleton(skel: Skeleton): ImageBitmap
    fun drawAnalysisResults(analysisResults: AnalysisResult): ImageBitmap
    fun crop(rect: Rect): InputFrame

    val timestamp: Long
}

expect class FrameAnalyser(model: ObjectModel?) {
    suspend fun analyseFrame(inputFrame: InputFrame, focusArea: Rect? = null): AnalysisResult
}

data class AnalysisObject(
    val boundingBox: Rect,
    val trackingId: Int?,
    val labels: List<Label>,
    val frameSize: FrameSize
)

data class FrameSize(
    val width: Int,
    val height: Int)

data class Label(
    val text: String,
    val confidence: Float
)

data class AnalysisResult(
    val skeleton: Skeleton?,
    val objects: List<AnalysisObject>
)
