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

export const scanLog = pgTable("scan_log", {
	id: uuid("id").defaultRandom().primaryKey(),
	user: text("user"),
	scannerId: text("scanner_id"),
	message: text("message").notNull(),
	prompt: text("prompt"),
	commandDescription: text("command_description"),
	runningNumber: text("running_number").default("0"),
	status: text("status"),
	scannerVersion: text("scanner_version").default("0"),
	lines: jsonb("lines").default([]),
	add_Date: timestamp("add_date", { withTimezone: true }).defaultNow(),
});

export const scanLogSchema = createSelectSchema(scanLog);
export const newScanLogSchema = createInsertSchema(scanLog);

export type Printer = z.infer<typeof scanLogSchema>;
export type NewPrinter = z.infer<typeof newScanLogSchema>;
