package de.ladkau.deckinadash.nativebridge

/**
 * JNI bridge to the native `deckengine` shared library (built from
 * app/src/main/jni/CMakeLists.txt, which links the same engine +
 * interpreter C sources the watch app links - see that CMakeLists.txt's
 * own comment). One call returns one complete JSON snapshot of a day's
 * reading; see app/src/main/jni/reading_json.h for the exact schema and
 * why this is a single call rather than many fine-grained accessors.
 */
object DeckNative {
    init {
        System.loadLibrary("deckengine")
    }

    /**
     * @param gender 0 = unspecified, 1 = male, 2 = female - matches
     *   engine/src/tarot.h's Gender enum order.
     * @param i18nDir directory containing `<lang>.lang` files (see
     *   engine/i18n/), synced from assets by DeckInADashApp.onCreate().
     * @throws IllegalStateException if native JSON generation fails.
     */
    external fun generateReadingJson(
        birthYear: Int,
        birthMonth: Int,
        birthDay: Int,
        birthHour: Int,
        birthMinute: Int,
        utcOffsetHours: Double,
        latitude: Double,
        longitude: Double,
        gender: Int,
        utcMomentEpochSeconds: Long,
        i18nDir: String,
        lang: String,
    ): String
}
