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

export const forkliftCompanies = pgTable("forklift_companies", {
	id: uuid("id").defaultRandom().primaryKey(),
	name: text("name").notNull().unique(),
	active: boolean("active").default(true),
	add_date: timestamp("add_date").defaultNow(),
	add_user: text("add_user").default("LST"),
	upd_date: timestamp("upd_date").defaultNow(),
	upd_user: text("upd_user").default("LST"),
});

export const selectForkliftCompanySchema =
	createSelectSchema(forkliftCompanies);

export const insertForkliftCompanySchema = createInsertSchema(
	forkliftCompanies,
).extend({
	name: z.string().min(3),
	// zipcode: z
	//     .string()
	//     .regex(/^\d{5}$/)
	//     .optional(),
});
