<script setup>
import { ArrowPathIcon } from "@heroicons/vue/24/outline";
import { useForm } from "@inertiajs/vue3";

// creates form to send SelectedFiles Request
const form = useForm({
    all: null,
    Ids: [],
});

// define props
const props = defineProps({
    restoreall: {
        type: Boolean,
        default: false,
        required: false,
    },
    selected: {
        type: Array,
        required: false,
    },
});

// define delete function
const onClick = () => {
    form.all = props.restoreall;
    form.Ids = props.selected;

    form.post(route("file.restore"));
};
</script>

<template>
    <button
        @click="onClick()"
        class="border-gray-700 border px-3 py-2 rounded hover:bg-emerald-600 hover:border-emerald-600 flex flex justify-center items-center gap-2"
    >
        <ArrowPathIcon class="h-5 w-5" aria-hidden="true" /> Restore
    </button>
</template>
