<template>
  <RouterLink
    :to="{ name: 'admin-unit-inspection_plan-overview', params: { inspectionPlanId: inspectionPlan.id } }"
    class="flex flex-col h-fit w-full border border-primary rounded-md"
  >
    <div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
      <p>{{ inspectionPlan.title }} - {{ inspectionPlan.related.type }}</p>
    </div>
    <div class="p-2">
      <p>Interval: {{ inspectionPlan.inspectionInterval }}</p>
    </div>
  </RouterLink>
</template>

<script setup lang="ts">
import { defineComponent, type PropType } from "vue";
import { mapState, mapActions } from "pinia";
import { useAbilityStore } from "@/stores/ability";
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
</script>

<script lang="ts">
export default defineComponent({
  props: {
    inspectionPlan: { type: Object as PropType<InspectionPlanViewModel>, default: {} },
  },
  computed: {
    ...mapState(useAbilityStore, ["can"]),
  },
});
</script>
