package com.omixlab.lckcontrol.data.remote

import com.squareup.moshi.JsonClass

// ── Incoming events from WebSocket ──────────────────────

@JsonClass(generateAdapter = true)
data class ChatMessageEvent(
    val type: String,
    val planId: String,
    val service: String,
    val destinationId: String,
    val message: ChatMessage,
)

@JsonClass(generateAdapter = true)
data class ChatMessage(
    val id: String,
    val authorName: String,
    val authorImageUrl: String? = null,
    val text: String,
    val timestamp: Long,
    val isModerator: Boolean = false,
    val isBroadcaster: Boolean = false,
    val color: String? = null,
)

@JsonClass(generateAdapter = true)
data class ChatStatusEvent(
    val type: String,
    val planId: String,
    val service: String? = null,
    val destinationId: String? = null,
    val connected: Boolean? = null,
    val error: String? = null,
)

// ── Outgoing commands to WebSocket ──────────────────────

@JsonClass(generateAdapter = true)
data class SubscribeCommand(
    val type: String = "subscribe",
    val planId: String,
)

@JsonClass(generateAdapter = true)
data class UnsubscribeCommand(
    val type: String = "unsubscribe",
    val planId: String,
)

@JsonClass(generateAdapter = true)
data class SendChatCommand(
    val type: String = "send_message",
    val planId: String,
    val destinationId: String,
    val text: String,
)

data class ChatConnectionStatus(
    val connected: Boolean,
    val error: String? = null,
)
