import { boolean, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
import type { z } from "zod";

export const dockDoorScanners = pgTable("dock_door_scanners", {
	id: uuid("id").defaultRandom().primaryKey(),
	ip: text("ip").notNull(),
	name: text("name").unique(),
	dockId: text("dock_id"),
	active: boolean("active").default(true),
	currentLoadingOrder: text("current_loading_order").default(""),
	add_date: timestamp("add_date", { withTimezone: true }).defaultNow(),
	add_user: text("add_user").default("lst-system"),
	upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(),
	upd_user: text("upd_user").default("lst-system"),
});

export const dockDoorScannersSchema = createSelectSchema(dockDoorScanners);
export const newDockDoorScannersSchema = createInsertSchema(dockDoorScanners);

export type DockDoorScanners = z.infer<typeof dockDoorScannersSchema>;
export type NewDockDoorScanners = z.infer<typeof newDockDoorScannersSchema>;
