<template>
  <view class="poi-detail-card bg-white rounded-24 overflow-hidden">
    <view class="poi-detail-card__hero relative">
      <image class="poi-detail-card__image w-full h-full block rounded-18" :src="data.image" mode="aspectFill" />
      <view class="poi-detail-card__badge flex flex-items-center gap-4 font-size-10 font-900">
        <text class="poi-detail-card__badge-icon">⌖</text>
        <text>{{ data.badge?.text }}</text>
      </view>
    </view>

    <view class="poi-detail-card__body">
      <view class="poi-detail-card__title color-1E293B font-size-24 font-900">
        {{ data.title }}
      </view>

      <view class="poi-detail-card__tip flex flex-items-center gap-10">
        <view class="poi-detail-card__spark color-047857 font-size-18 font-900">✦</view>
        <view class="poi-detail-card__tip-text color-047857 font-size-14 font-800">
          {{ data.tip?.text }}
        </view>
      </view>

      <view
        class="poi-detail-card__button flex flex-items-center flex-justify-center gap-8 color-white bg-[#0f172a] font-size-16 font-900"
        :class="{ 'is-disabled': disabled }" @click="handleAction">
        <text class="poi-detail-card__button-icon">↗</text>
        <text>{{ data.action?.text }}</text>
      </view>
    </view>
  </view>
</template>

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

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

const handleAction = () => {
  if (props.disabled) return;
  emit("action", props.data);
};
</script>

<style scoped lang="scss">
@import "./styles/index.scss";
</style>
