import React, { useMemo } from 'react';
import { Link } from '@backstage/core-components';
import { useRouteRef } from '@backstage/core-plugin-api';
import { optimizationsBreakdownRouteRef } from '../../../../routes.esm.js';
import { getTimeFromNow } from '../../../../utils/dates.esm.js';

function useTableColumns() {
  const columns = useMemo(
    () => [
      {
        title: "Container",
        field: "container",
        render: (data) => {
          const link = useRouteRef(optimizationsBreakdownRouteRef);
          return React.createElement(Link, {
            to: link({ id: data.id }),
            children: data.container
          });
        }
      },
      {
        title: "Project",
        field: "project"
      },
      {
        title: "Workload",
        field: "workload"
      },
      {
        title: "Type",
        field: "workloadType"
      },
      {
        title: "Cluster",
        field: "clusterAlias"
      },
      {
        title: "Last reported",
        field: "lastReported",
        render(data, _type) {
          return getTimeFromNow(data.lastReported?.toString());
        }
      }
    ],
    []
  );
  return columns;
}

export { useTableColumns };
//# sourceMappingURL=useTableColumns.esm.js.map
