<script setup lang="ts">
import { Head, Link } from '@inertiajs/vue3';
import { ArrowLeft } from '@lucide/vue';
import RoleForm from '@/components/admin/system/roles/RoleForm.vue';
import { Button } from '@/components/ui/button';
import AdminLayout from '@/layouts/AdminLayout.vue';

interface PermissionOption {
    value: string;
    label: string;
    group: string;
}

defineProps<{
    permissions: PermissionOption[];
}>();
</script>

<template>
    <Head title="Tambah Role" />

    <AdminLayout>
        <div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
            <div class="space-y-1">
                <h2 class="text-2xl font-bold tracking-tight">
                    Tambah Role
                </h2>
            </div>

            <Button variant="outline" as-child class="shrink-0 self-start sm:self-center">
                <Link href="/admin/system/roles">
                    <ArrowLeft class="size-4" />
                    Kembali
                </Link>
            </Button>
        </div>

        <RoleForm submit-url="/admin/system/roles" method="post" submit-label="Simpan" :permissions="permissions" />
    </AdminLayout>
</template>
