/*
 * SPDX-License-Identifier: GPL-3.0-or-later
 */
package com.runicgateway.app.core.push

import androidx.annotation.StringRes
import com.runicgateway.app.R

/**
 * The known push stream ids (mirrors the backend catalog in
 * `config/notificationStreams.js`) and their localized notification titles.
 * The subscribable catalog itself is fetched from
 * `GET /auth/me/notifications/streams`; this fixed set is only what the receiver
 * needs to title a content-free tickle without a network round-trip (§11).
 */
object PushStreams {
    const val NEWS_POST = "news.post"
    const val SERVER_STATUS = "server.status"
    const val IDOC_WARNING = "idoc.warning"
    const val CHAMP_START = "champ.start"
    const val GOVERNOR_ELECTION = "governor.election"
    const val VENDOR_SALE = "vendor.sale"
    const val HOUSE_IDOC = "house.idoc"
    const val ACCOUNT_LOGIN = "account.login"

    /** A short, localized notification title for [streamId]; a generic fallback otherwise. */
    @StringRes
    fun titleRes(streamId: String): Int = when (streamId) {
        NEWS_POST -> R.string.push_stream_news_post
        SERVER_STATUS -> R.string.push_stream_server_status
        IDOC_WARNING -> R.string.push_stream_idoc_warning
        CHAMP_START -> R.string.push_stream_champ_start
        GOVERNOR_ELECTION -> R.string.push_stream_governor_election
        VENDOR_SALE -> R.string.push_stream_vendor_sale
        HOUSE_IDOC -> R.string.push_stream_house_idoc
        ACCOUNT_LOGIN -> R.string.push_stream_account_login
        else -> R.string.push_stream_generic
    }
}
