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 openOrderColumns: ColumnDef<Adjustmnets>[] = [
	{
		accessorKey: "Remark",
		header: () => <div className="text-left">Carrier/Remark</div>,
		cell: ({ row }) => {
			const remark: any = row.getValue("Remark");
			if (!remark) {
				return <p className="text-gray-700/35">No remark</p>;
			}
			return <p>{remark}</p>;
		},
	},
	{
		accessorKey: "DeliveryAddressDescription",
		header: "Delivery Address",
	},
	{
		accessorKey: "header",
		header: "PO",
	},
	{
		accessorKey: "releaseNumber",
		header: "Release #",
	},
	{
		accessorKey: "deliveryDate",
		header: "DeliveryDate",
		cell: ({ row }) => {
			if (row.getValue("deliveryDate")) {
				// const correctDate = format(
				//     row.getValue("deliveryDate"),
				//     "M/d/yyyy hh:mm"
				// );
				return (
					<div className="text-left font-medium">
						{row.getValue("deliveryDate")}
					</div>
				);
			}
		},
	},
	{
		accessorKey: "customerItemNumber",
		header: "Material #",
	},
];
