package com.jsjdesigns.poker

import androidx.annotation.DrawableRes

/**
 * Maps a deck index (0..51) to its drawable.
 *
 * Generated by tools/generate_card_assets.sh's companion step — regenerate rather
 * than hand-editing. References are static so R8 resource shrinking cannot strip
 * the artwork, which `getIdentifier` lookups would risk.
 *
 * Order matches [com.jsjdesigns.poker.core.Card]: index = (rank - 2) * 4 + suit,
 * suits ordered clubs, diamonds, hearts, spades.
 */
private val CARD_FACES = intArrayOf(
    R.drawable.card_2_of_clubs,  // 0
    R.drawable.card_2_of_diamonds,  // 1
    R.drawable.card_2_of_hearts,  // 2
    R.drawable.card_2_of_spades,  // 3
    R.drawable.card_3_of_clubs,  // 4
    R.drawable.card_3_of_diamonds,  // 5
    R.drawable.card_3_of_hearts,  // 6
    R.drawable.card_3_of_spades,  // 7
    R.drawable.card_4_of_clubs,  // 8
    R.drawable.card_4_of_diamonds,  // 9
    R.drawable.card_4_of_hearts,  // 10
    R.drawable.card_4_of_spades,  // 11
    R.drawable.card_5_of_clubs,  // 12
    R.drawable.card_5_of_diamonds,  // 13
    R.drawable.card_5_of_hearts,  // 14
    R.drawable.card_5_of_spades,  // 15
    R.drawable.card_6_of_clubs,  // 16
    R.drawable.card_6_of_diamonds,  // 17
    R.drawable.card_6_of_hearts,  // 18
    R.drawable.card_6_of_spades,  // 19
    R.drawable.card_7_of_clubs,  // 20
    R.drawable.card_7_of_diamonds,  // 21
    R.drawable.card_7_of_hearts,  // 22
    R.drawable.card_7_of_spades,  // 23
    R.drawable.card_8_of_clubs,  // 24
    R.drawable.card_8_of_diamonds,  // 25
    R.drawable.card_8_of_hearts,  // 26
    R.drawable.card_8_of_spades,  // 27
    R.drawable.card_9_of_clubs,  // 28
    R.drawable.card_9_of_diamonds,  // 29
    R.drawable.card_9_of_hearts,  // 30
    R.drawable.card_9_of_spades,  // 31
    R.drawable.card_10_of_clubs,  // 32
    R.drawable.card_10_of_diamonds,  // 33
    R.drawable.card_10_of_hearts,  // 34
    R.drawable.card_10_of_spades,  // 35
    R.drawable.card_jack_of_clubs,  // 36
    R.drawable.card_jack_of_diamonds,  // 37
    R.drawable.card_jack_of_hearts,  // 38
    R.drawable.card_jack_of_spades,  // 39
    R.drawable.card_queen_of_clubs,  // 40
    R.drawable.card_queen_of_diamonds,  // 41
    R.drawable.card_queen_of_hearts,  // 42
    R.drawable.card_queen_of_spades,  // 43
    R.drawable.card_king_of_clubs,  // 44
    R.drawable.card_king_of_diamonds,  // 45
    R.drawable.card_king_of_hearts,  // 46
    R.drawable.card_king_of_spades,  // 47
    R.drawable.card_ace_of_clubs,  // 48
    R.drawable.card_ace_of_diamonds,  // 49
    R.drawable.card_ace_of_hearts,  // 50
    R.drawable.card_ace_of_spades,  // 51
)

@DrawableRes
fun cardFace(index: Int): Int = CARD_FACES[index]

@DrawableRes
fun cardBack(): Int = R.drawable.card_back
