<template>
  <div class="go-detailed-scene">
    <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="(scene, index) in option.dataset" :key="index" class="scene-row">
        <div class="scene-icon-container">
          <svg-icon :icon-class="scene.icon" class="scene-icon"></svg-icon>
        </div>
        <div class="scene-name" :style="{ color: option.sceneNameColor, fontSize: option.sceneNameSize + 'px' }">{{ scene.name }}</div>
        <div class="metrics-container">
          <div v-for="(metric, mIndex) in scene.metrics" :key="mIndex" class="metric">
            <div class="metric-label">
              <span class="point" :style="{ backgroundColor: mIndex === 0 ? option.pointColor1 : option.pointColor2 }"></span>
              <span :style="{ color: option.labelColor, fontSize: option.labelSize + 'px' }">{{ metric.label }}</span>
            </div>
            <div class="metric-value" :style="{ color: option.valueColor, fontSize: option.valueSize + 'px' }">{{ metric.value }}</div>
          </div>
        </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-detailed-scene {
  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;
    flex-direction: column;
    justify-content: space-around;
  }

  .scene-row {
    display: flex;
    align-items: center;
    background-color: rgba(26, 56, 90, 0.5);
    border-radius: 50px;
    padding: 10px 20px;
    margin: 10px 0;
  }

  .scene-icon-container {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, #00E5FF 0%, rgba(15, 28, 61, 0) 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;

    .scene-icon {
      font-size: 32px;
      color: #ffffff;
    }
  }

  .scene-name {
    font-weight: bold;
    margin-right: auto;
  }

  .metrics-container {
    display: flex;
    .metric {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-left: 20px;
      .metric-label {
        display: flex;
        align-items: center;
        margin-bottom: 5px;
        .point {
          width: 8px;
          height: 8px;
          border-radius: 50%;
          margin-right: 5px;
        }
      }
      .metric-value {
        font-weight: bold;
      }
    }
  }
}
</style>
