import {
	boolean,
	index,
	jsonb,
	numeric,
	pgTable,
	text,
	timestamp,
	uniqueIndex,
	uuid,
} from "drizzle-orm/pg-core";

export const printers = pgTable(
	"printers",
	{
		printer_id: uuid("printer_id").defaultRandom().primaryKey(),
		humanReadableId: text("humanReadableId"),
		name: text("name").notNull(),
		ipAddress: text("ip_address"),
		port: numeric("port"),
		status: text("status"),
		statusText: text("status_text"),
		lastTimePrinted: timestamp("last_time_printed").notNull().defaultNow(),
		assigned: boolean("assigned").default(false),
		remark: text("remark"),
		printDelay: numeric("print_delay").default("90"),
		monitorState: boolean("monitor_state").default(false),
		processes: jsonb("processes").default([]),
		printDelayOverride: boolean("print_delay_override").default(false), // this will be more for if we have the lot time active but want to over ride this single line for some reason
		add_Date: timestamp("add_Date").defaultNow(),
		upd_date: timestamp("upd_date").defaultNow(),
	},
	(table) => [uniqueIndex("humanReadableId").on(table.humanReadableId)],
);
