<script setup>
import Table from "@/components/customUI/Table.vue";
import { inject, computed } from "vue";
import { useI18n } from "vue-i18n";
const { t } = useI18n();

const columns = computed(() => [
  {
    title: t("history.building_name"),
    key: "building_name",
    sort: true,
  },
  {
    title: t("history.device_name"),
    key: "device_name",
    width: "30%",
    filter: true,
    sort: true,
  },
  {
    title: t("history.category"),
    key: "item_name",
  },
  {
    title: t("history.value"),
    key: "value",
    sort: true,
    filter: true,
  },
  {
    title: t("history.date"),
    key: "timestamp",
    width: "20%",
    sort: true,
  },
]);

const { tableData, loading } = inject("history_table_data");
</script>

<template>
  <Table :columns="columns" :dataSource="tableData" :loading="loading"></Table>
</template>

<style lang="scss" scoped></style>
