<template>
  <div class="go-scene-distribution">
    <div class="header">
      <div class="title">
        <svg-icon icon-class="rocket" class="title-icon"></svg-icon>
        <span :style="{ color: option.titleColor, fontSize: option.titleSize + 'px' }">{{ option.title }}</span>
      </div>
      <a class="link" :style="{ color: option.linkColor }">{{ option.linkText }}</a>
    </div>
    <div class="content">
      <div v-for="(item, index) in option.dataset" :key="index" class="scene-item">
        <div class="item-label" :style="{ color: option.labelColor, fontSize: option.labelSize + 'px' }">{{ item.label }}</div>
        <div class="cube-container">
          <div class="cube-image" :style="{ '--glow-color': item.color }">
            <svg-icon icon-class="camera" class="camera-icon"></svg-icon>
          </div>
        </div>
        <div class="item-value" :style="{ color: option.valueColor, fontSize: option.valueSize + 'px' }">{{ item.value }}</div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { PropType, computed } from 'vue'
import { option as configOption } from './config'

const props = defineProps({
  chartConfig: {
    type: Object as PropType<{ option: typeof configOption }>,
    required: true
  }
})

const option = computed(() => props.chartConfig.option)
</script>

<style lang="scss" scoped>
.go-scene-distribution {
  width: 100%;
  height: 100%;
  background-color: #0F1C3D;
  padding: 15px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;

  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #1A385A;
    padding: 5px 15px;
    border-radius: 5px;
    margin-bottom: 20px;

    .title {
      display: flex;
      align-items: center;
      .title-icon {
        font-size: 24px;
        margin-right: 10px;
        color: #00E5FF;
      }
    }

    .link {
      cursor: pointer;
      font-size: 14px;
    }
  }

  .content {
    flex: 1;
    display: flex;
    justify-content: space-around;
    align-items: center;
  }

  .scene-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;

    .item-label {
      margin-bottom: 20px;
    }

    .cube-container {
      position: relative;
      width: 120px;
      height: 120px;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 20px;

      .cube-image {
        width: 80px;
        height: 80px;
        border: 2px solid var(--glow-color);
        background-color: rgba(var(--glow-color), 0.1);
        box-shadow: 0 0 15px var(--glow-color);
        display: flex;
        align-items: center;
        justify-content: center;
        
        .camera-icon {
          font-size: 40px;
          color: var(--glow-color);
        }
      }
    }

    .item-value {
      font-weight: bold;
      background: #2A3A5B;
      padding: 5px 20px;
      border-radius: 5px;
    }
  }
}
</style>
