package com.omixlab.lckcontrol.p2p.channels

import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
data class ControlMessage(
    val id: String,
    val type: String, // "request", "response", "event"
    val method: String? = null,
    val payload: Map<String, Any?>? = null,
    val error: String? = null,
)

// Supported methods:
// Phone→Quest requests:
//   getDeviceStatus, getStreamPlans, prepareStreamPlan, startStreamPlan,
//   endStreamPlan, getStreamingStats, getLinkedAccounts, getCortexState,
//   listFiles, startVideoStream, stopVideoStream
//
// Quest→Phone events:
//   streamingStateChanged, planUpdated, cortexSessionUpdate

// File channel binary protocol:
// [type:u8][transferId:16B][payload]
object FileProtocol {
    const val FILE_LIST_REQUEST: Byte = 0x01
    const val FILE_LIST_RESPONSE: Byte = 0x02
    const val FILE_REQUEST: Byte = 0x03
    const val FILE_HEADER: Byte = 0x04
    const val FILE_CHUNK: Byte = 0x05
    const val FILE_COMPLETE: Byte = 0x06
    const val FILE_ACK: Byte = 0x07

    const val CHUNK_SIZE = 16 * 1024 // 16KB
    const val ACK_INTERVAL = 32
}
