#include "resource_map.h"

#include <pebble.h>

uint32_t card_resource_id(TarotCard card) {
  switch (card) {
    case CARD_FOOL: return RESOURCE_ID_IMG_CARD_FOOL;
    case CARD_MAGICIAN: return RESOURCE_ID_IMG_CARD_MAGICIAN;
    case CARD_HIGH_PRIESTESS: return RESOURCE_ID_IMG_CARD_HIGH_PRIESTESS;
    case CARD_EMPRESS: return RESOURCE_ID_IMG_CARD_EMPRESS;
    case CARD_EMPEROR: return RESOURCE_ID_IMG_CARD_EMPEROR;
    case CARD_HIEROPHANT: return RESOURCE_ID_IMG_CARD_HIEROPHANT;
    case CARD_LOVERS: return RESOURCE_ID_IMG_CARD_LOVERS;
    case CARD_CHARIOT: return RESOURCE_ID_IMG_CARD_CHARIOT;
    case CARD_STRENGTH: return RESOURCE_ID_IMG_CARD_STRENGTH;
    case CARD_HERMIT: return RESOURCE_ID_IMG_CARD_HERMIT;
    case CARD_WHEEL_OF_FORTUNE: return RESOURCE_ID_IMG_CARD_WHEEL_OF_FORTUNE;
    case CARD_JUSTICE: return RESOURCE_ID_IMG_CARD_JUSTICE;
    case CARD_HANGED_MAN: return RESOURCE_ID_IMG_CARD_HANGED_MAN;
    case CARD_DEATH: return RESOURCE_ID_IMG_CARD_DEATH;
    case CARD_TEMPERANCE: return RESOURCE_ID_IMG_CARD_TEMPERANCE;
    case CARD_DEVIL: return RESOURCE_ID_IMG_CARD_DEVIL;
    case CARD_TOWER: return RESOURCE_ID_IMG_CARD_TOWER;
    case CARD_STAR: return RESOURCE_ID_IMG_CARD_STAR;
    case CARD_MOON: return RESOURCE_ID_IMG_CARD_MOON;
    case CARD_SUN: return RESOURCE_ID_IMG_CARD_SUN;
    case CARD_JUDGEMENT: return RESOURCE_ID_IMG_CARD_JUDGEMENT;
    case CARD_WORLD: return RESOURCE_ID_IMG_CARD_WORLD;
  }
  return RESOURCE_ID_IMG_CARD_FOOL; /* unreachable for a valid TarotCard */
}

int16_t card_image_height_for_width(int16_t width) {
  return (int16_t)((width * 1810 + 543) / 1086); /* +543 = round, not truncate */
}
