/** type → Emoji + 标签文字映射 */
const TAG_MAP: Record<string, { emoji: string; label: string }> = {
  chinese: { emoji: '🎱', label: '中式' },
  snooker: { emoji: '斯', label: '斯诺克' },
  mahjong: { emoji: '🀅', label: '麻将' },
  karaoke: { emoji: '🎤', label: 'K歌' },
}

Component({
  properties: {
    /** 喜好类型 */
    type: {
      type: String,
      value: 'chinese',
    },
  },

  observers: {
    type(val: string) {
      const tag = TAG_MAP[val] || { emoji: '❓', label: val }
      this.setData({ emoji: tag.emoji, label: tag.label })
    },
  },

  data: {
    emoji: '🎱',
    label: '中式',
  },

  lifetimes: {
    attached() {
      const tag = TAG_MAP[this.data.type] || { emoji: '❓', label: this.data.type }
      this.setData({ emoji: tag.emoji, label: tag.label })
    },
  },
})
