package com.pixelized.shared.lwa.protocol.websocket

import kotlinx.serialization.Serializable

@Serializable
sealed interface ApiSynchronisation : SocketMessage {

    @Serializable
    sealed interface CharacterSheetApiSynchronisation : ApiSynchronisation, CharacterSheetIdMessage

    @Serializable
    data class CharacterSheetDelete(
        override val timestamp: Long,
        override val characterSheetId: String,
    ) : CharacterSheetApiSynchronisation

    @Serializable
    data class CharacterSheetUpdate(
        override val timestamp: Long,
        override val characterSheetId: String,
    ) : CharacterSheetApiSynchronisation

    @Serializable
    sealed interface AlterationApiSynchronisation : ApiSynchronisation

    @Serializable
    data class AlterationUpdate(
        override val timestamp: Long,
        val alterationId: String,
    ) : AlterationApiSynchronisation

    @Serializable
    data class AlterationDelete(
        override val timestamp: Long,
        val alterationId: String,
    ) : AlterationApiSynchronisation

    @Serializable
    sealed interface ItemApiSynchronisation : ApiSynchronisation

    @Serializable
    data class ItemUpdate(
        override val timestamp: Long,
        val itemId: String,
    ) : ItemApiSynchronisation

    @Serializable
    data class ItemDelete(
        override val timestamp: Long,
        val itemId: String,
    ) : ItemApiSynchronisation

    @Serializable
    sealed interface InventoryApiSynchronisation : ApiSynchronisation, CharacterSheetIdMessage

    @Serializable
    data class PurseUpdate(
        override val timestamp: Long,
        override val characterSheetId: String,
        val add : Boolean,
        val gold: Int,
        val silver: Int,
        val copper: Int,
    ) : InventoryApiSynchronisation

    @Serializable
    data class InventoryUpdate(
        override val timestamp: Long,
        override val characterSheetId: String,
    ) : InventoryApiSynchronisation

    @Serializable
    data class InventoryDelete(
        override val timestamp: Long,
        override val characterSheetId: String,
    ) : InventoryApiSynchronisation

    @Serializable
    sealed interface MapApiSynchronisation : ApiSynchronisation

    @Serializable
    data class MapUpdate(
        override val timestamp: Long,
        val id: String,
    ) : MapApiSynchronisation

    @Serializable
    data class MapDelete(
        override val timestamp: Long,
        val id: String,
    ) : MapApiSynchronisation
}