<template>
  <AppLayout title="Exam Type Details">
    <div class="space-y-6">
      <!-- Header -->
      <div class="flex items-center justify-between">
        <div>
          <h1 class="text-3xl font-bold tracking-tight">{{ examType.name }}</h1>
          <p class="text-muted-foreground">{{ examType.academicYear?.name }}</p>
        </div>
        <div class="flex space-x-3">
          <Button variant="outline" as-child>
            <Link :href="route('exam-types.edit', examType.id)">
              <Edit class="mr-2 h-4 w-4" />
              Edit Exam Type
            </Link>
          </Button>
          <Button variant="outline" as-child>
            <Link :href="route('exam-types.index')">
              <ArrowLeft class="mr-2 h-4 w-4" />
              Back to Exam Types
            </Link>
          </Button>
        </div>
      </div>

      <Card>
        <CardHeader>
          <CardTitle>Exam Type Information</CardTitle>
        </CardHeader>
        <CardContent class="space-y-4">
          <div class="grid grid-cols-2 gap-4">
            <div>
              <Label class="text-sm font-medium text-muted-foreground">Name</Label>
              <p class="text-sm">{{ examType.name }}</p>
            </div>
            <div>
              <Label class="text-sm font-medium text-muted-foreground">Weight</Label>
              <p class="text-sm">{{ examType.weight }}%</p>
            </div>
            <div>
              <Label class="text-sm font-medium text-muted-foreground">Academic Year</Label>
              <p class="text-sm">{{ examType.academicYear?.name }}</p>
            </div>
            <div>
              <Label class="text-sm font-medium text-muted-foreground">Status</Label>
              <Badge :variant="examType.is_active ? 'default' : 'secondary'">
                {{ examType.is_active ? 'Active' : 'Inactive' }}
              </Badge>
            </div>
            <div class="col-span-2">
              <Label class="text-sm font-medium text-muted-foreground">Description</Label>
              <p class="text-sm">{{ examType.description || 'No description provided' }}</p>
            </div>
          </div>
        </CardContent>
      </Card>
    </div>
  </AppLayout>
</template>

<script setup lang="ts">
import { Link } from '@inertiajs/vue3'
import AppLayout from '@/layouts/AppLayout.vue'
import { Button } from '@/components/ui/button'
import { Badge } from '@/components/ui/badge'
import { Label } from '@/components/ui/label'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Edit, ArrowLeft } from 'lucide-vue-next'

const props = defineProps<{
  examType: any
}>()
</script>
