import {
    integer,
    pgTable,
    uuid,
    uniqueIndex,
    text,
    timestamp,
} from "drizzle-orm/pg-core";
import { createSelectSchema } from "drizzle-zod";

export const prodlabels = pgTable(
    "prodlabels",
    {
        label_id: uuid("label_id").defaultRandom().primaryKey(),
        printerID: integer("printerID"),
        printerName: text("printerName"),
        line: integer("line"),
        runningNr: integer("runningNr").notNull(),
        status: text("status"),
        add_user: text("add_user").default("lst"),
        add_date: timestamp("add_date").defaultNow(),
        upd_date: timestamp("upd_date").defaultNow(),
    },
    (table) => [
        //uniqueIndex("emailUniqueIndex").on(sql`lower(${table.email})`),
        uniqueIndex("runningNr").on(table.runningNr),
    ]
);

export const prodlabelsSchema = createSelectSchema(prodlabels);
