<template>
  <div
    class="bg-white rounded-[24px] w-full pt-8 px-8 pb-6 border border-slate-200/72 shadow-[0_12px_30px_rgba(15,23,42,0.05)]">
    <div class="flex items-center">
      <div
        class="w-6 h-6 mr-2.5 border-2 border-emerald-500 text-emerald-500 leading-5 flex items-center justify-center rounded-full text-[16px] font-bold">
        {{ data.icon }}
      </div>
      <div class="leading-[26px] text-[#1e293b] font-size-20 font-bold">
        {{ data.title }}
      </div>
    </div>

    <div class="h-px mt-6 mb-4 bg-slate-100"></div>

    <div class="faq-help-card__list">
      <div v-for="item in questions" :key="item.id || item.text"
        class="min-h-[42px] flex items-center active:opacity-86" :class="{ 'opacity-55': disabled }"
        @click="handleSelect(item)">
        <div class="min-w-0 leading-[24px] text-[#475569] text-[18px] font-bold truncate flex-1">
          {{ item.text }}
        </div>
        <van-icon name="arrow" size="16" color="#CBD5E1"></van-icon>
      </div>
    </div>
  </div>
</template>

<script setup>
import { computed } from "vue";

const props = defineProps({
  data: {
    type: Object,
    default: () => ({}),
  },
  disabled: {
    type: Boolean,
    default: false,
  },
});

const emit = defineEmits(["select"]);

const questions = computed(() => props.data.questions || []);

const handleSelect = (item) => {
  if (props.disabled) return;
  emit("select", item);
};
</script>
