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

export const ocmeCycleCounts = pgTable(
    "ocmeCycleCounts",
    {
        ocme_id: uuid("ocme_id").defaultRandom().primaryKey(),
        laneId: integer("laneId").notNull(),
        warehouseName: text("warehouseName").notNull(),
        laneName: text("laneName").notNull(),
        good: boolean("good").default(false),
        cycleCount: jsonb("cycleCount").default([]),
        add_User: text("add_User").default("LST_System").notNull(),
        add_Date: timestamp("add_Date").defaultNow(),
    },
    (table) => [
        // uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),
        // uniqueIndex("role_name").on(table.name),
        //uniqueIndex("ocme_runningNr").on(table.runningNr),
    ]
);

// Schema for inserting a user - can be used to validate API requests
// export const insertRolesSchema = createInsertSchema(roles, {
//     name: z.string().min(3, {message: "Role name must be more than 3 letters"}),
// });
// Schema for selecting a Expenses - can be used to validate API responses
export const selectRolesSchema = createSelectSchema(ocmeCycleCounts);
