package top.yeij.cyrene.data.remote.dto

import com.google.gson.annotations.SerializedName

// --- Client → Server ---

data class WSClientMessage(
    @SerializedName("type") val type: String,
    @SerializedName("session_id") val sessionId: String? = null,
    @SerializedName("mode") val mode: String? = null,
    @SerializedName("content") val content: String? = null,
    @SerializedName("audio_data") val audioData: String? = null,
    @SerializedName("attachments") val attachments: List<WSAttachment>? = null,
    @SerializedName("timestamp") val timestamp: Long? = null,
    @SerializedName("client_id") val clientId: String? = null,
    @SerializedName("device_name") val deviceName: String? = null,
    @SerializedName("user_agent") val userAgent: String? = null,
)

data class WSAttachment(
    @SerializedName("type") val type: String,
    @SerializedName("url") val url: String? = null,
    @SerializedName("file_id") val fileId: String? = null,
    @SerializedName("thumbnail_url") val thumbnailUrl: String? = null,
    @SerializedName("filename") val filename: String? = null,
    @SerializedName("width") val width: Int? = null,
    @SerializedName("height") val height: Int? = null,
    @SerializedName("size") val size: Long? = null,
    @SerializedName("description") val description: String? = null,
)

// --- Server → Client ---

data class WSClientInfo(
    @SerializedName("client_id") val clientId: String? = null,
    @SerializedName("device_name") val deviceName: String? = null,
)

data class WSServerMessage(
    @SerializedName("type") val type: String?,
    @SerializedName("message_id") val messageId: String? = null,
    @SerializedName("text") val text: String? = null,
    @SerializedName("content") val content: String? = null,
    @SerializedName("role") val role: String? = null,
    @SerializedName("msg_type") val msgType: String? = null,
    @SerializedName("session_id") val sessionId: String? = null,
    @SerializedName("error") val error: String? = null,
    @SerializedName("review_messages") val reviewMessages: List<WSReviewMessage>? = null,
    @SerializedName("messages") val messages: List<WSHistoryMessage>? = null,
    @SerializedName("multi_message") val multiMessages: List<WSMultiItem>? = null,
    @SerializedName("tool_progress") val toolProgress: WSToolProgress? = null,
    @SerializedName("thinking_status") val thinkingStatus: String? = null,
    @SerializedName("thinking_content") val thinkingContent: String? = null,
    @SerializedName("timestamp") val timestamp: Long? = null,
    @SerializedName("client_info") val clientInfo: WSClientInfo? = null,
)

data class WSReviewMessage(
    @SerializedName("type") val type: String? = null,
    @SerializedName("role") val role: String? = null,
    @SerializedName("text") val text: String? = null,
    @SerializedName("content") val content: String? = null,
    @SerializedName("msg_type") val msgType: String? = null,
    @SerializedName("delay_ms") val delayMs: Long? = 0,
    @SerializedName("metadata") val metadata: WSReviewMetadata? = null,
)

data class WSReviewMetadata(
    @SerializedName("language") val language: String? = null,
    @SerializedName("url") val url: String? = null,
)

data class WSHistoryMessage(
    @SerializedName("id") val id: String?,
    @SerializedName("role") val role: String?,
    @SerializedName("content") val content: String?,
    @SerializedName("msg_type") val msgType: String?,
    @SerializedName("timestamp") val timestamp: Long?,
    @SerializedName("name") val name: String?,
)

data class WSMultiItem(
    @SerializedName("role") val role: String?,
    @SerializedName("content") val content: String?,
    @SerializedName("msg_type") val msgType: String?,
)

data class WSToolProgress(
    @SerializedName("tool_name") val toolName: String?,
    @SerializedName("status") val status: String?,
    @SerializedName("detail") val detail: String?,
    @SerializedName("message") val message: String?,
    @SerializedName("progress") val progress: Int? = null,
)
