package com.correx.core.talkie.l3

import com.correx.core.events.types.SessionId
import kotlinx.serialization.Serializable

@Serializable
data class L3Query(
    val vector: FloatArray,
    val k: Int,
    val sessionIdFilter: SessionId? = null
) {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as L3Query

        if (!vector.contentEquals(other.vector)) return false
        if (k != other.k) return false
        if (sessionIdFilter != other.sessionIdFilter) return false

        return true
    }

    override fun hashCode(): Int {
        var result = vector.contentHashCode()
        result = 31 * result + k
        result = 31 * result + (sessionIdFilter?.hashCode() ?: 0)
        return result
    }

    override fun toString(): String {
        return "L3Query(vector=${vector.contentToString()}, k=$k, sessionIdFilter=$sessionIdFilter)"
    }
}
