//import { fixTime } from "@/utils/fixTime";
import { type ColumnDef } from "@tanstack/react-table";
import { format } from "date-fns-tz";

// This type is used to define the shape of our data.
// You can use a Zod schema here if you want.
export type Adjustmnets = {
	siloAdjust_id: string;
	currentStockLevel: string;
	newLevel: number;
	dateAdjusted: string;
	lastDateAdjusted: string;
	comment: string;
	commentAddedBy: string;
	commentDate: string;
	add_user: string;
};

export const labelolumns: ColumnDef<Adjustmnets>[] = [
	{
		accessorKey: "line",
		header: () => <div className="text-left">Line</div>,
	},
	{
		accessorKey: "printerName",
		header: "Printer",
	},
	{
		accessorKey: "runningNr",
		header: "Running Number",
	},
	{
		accessorKey: "upd_date",
		header: "Label Date",
		cell: ({ row }) => {
			if (row.getValue("upd_date")) {
				const correctDate: any = row.getValue("upd_date");
				const strippedDate = correctDate.replace("Z", ""); // Remove Z
				const formattedDate = format(strippedDate, "MM/dd/yyyy HH:mm");
				return <div className="text-left font-medium">{formattedDate}</div>;
			}
		},
	},
	{
		accessorKey: "status",
		header: "Label Status",
	},
];
