<script setup lang="ts">
import { ref, computed } from 'vue'

const currentYear = computed(() => new Date().getFullYear())
const links = [
  { label: 'About', href: '#' },
  { label: 'Documentation', href: '#' },
  { label: 'Support', href: '#' },
  { label: 'Status', href: '#' },
]

interface StatusMap {
  backend: string
  database: string
  services: string
}

const statusData = ref<StatusMap>({
  backend: 'operational',
  database: 'operational',
  services: 'operational',
})
</script>

<template>
  <footer class="app-footer">
    <div class="footer-content">
      <!-- Status -->
      <div class="footer-section">
        <h4>System Status</h4>
        <div class="status-list">
          <div v-for="(value, key) in statusData" :key="key" class="status-item">
            <span class="status-indicator" :class="value"></span>
            <span class="status-label">{{ key.charAt(0).toUpperCase() + key.slice(1) }}</span>
          </div>
        </div>
      </div>

      <!-- Links -->
      <div class="footer-section">
        <h4>Links</h4>
        <nav class="footer-links">
          <a v-for="link in links" :key="link.label" :href="link.href" class="footer-link">
            {{ link.label }}
          </a>
        </nav>
      </div>

      <!-- Info -->
      <div class="footer-section footer-info">
        <p>K-ArtSell Aegis v1.0.0</p>
        <p>&copy; {{ currentYear }} All rights reserved</p>
      </div>
    </div>
  </footer>
</template>

<style scoped>
.app-footer {
  background-color: var(--color-background-secondary);
  border-top: var(--border-width-1) solid var(--color-border-primary);
  padding: var(--spacing-4);
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-6);
  max-width: 1400px;
  margin: 0 auto;
}

.footer-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
}

.footer-section h4 {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
}

.status-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: var(--border-radius-full);
  background-color: var(--color-neutral-400);
  flex-shrink: 0;
}

.status-indicator.operational {
  background-color: var(--color-success-500);
}

.status-indicator.warning {
  background-color: var(--color-warning-500);
}

.status-indicator.down {
  background-color: var(--color-danger-500);
}

.status-label {
  color: var(--color-text-secondary);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
}

.footer-link {
  color: var(--color-text-tertiary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--color-text-primary);
}

.footer-info {
  text-align: right;
}

.footer-info p {
  margin: 0;
  line-height: var(--line-height-normal);
}

@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-4);
  }

  .footer-info {
    text-align: left;
  }
}
</style>
