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

      <Card>
        <CardHeader>
          <CardTitle>Subject 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">{{ subject.name }}</p>
            </div>
            <div>
              <Label class="text-sm font-medium text-muted-foreground">Code</Label>
              <p class="text-sm">{{ subject.code }}</p>
            </div>
            <div class="col-span-2">
              <Label class="text-sm font-medium text-muted-foreground">Description</Label>
              <p class="text-sm">{{ subject.description || 'No description provided' }}</p>
            </div>
            <div>
              <Label class="text-sm font-medium text-muted-foreground">Status</Label>
              <Badge :variant="subject.is_active ? 'default' : 'secondary'">
                {{ subject.is_active ? 'Active' : 'Inactive' }}
              </Badge>
            </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<{
  subject: any
}>()
</script>
