package com.correx.core.events.serialization

import com.correx.core.events.events.EventPayload
import kotlinx.serialization.json.Json

class JsonEventSerializer(
    private val json: Json = eventJson
) : EventSerializer {

    override fun serialize(payload: EventPayload): String =
        json.encodeToString(EventPayload.serializer(), payload)

    override fun deserialize(raw: String): EventPayload =
        json.decodeFromString(EventPayload.serializer(), raw)
}
