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

export const forecastData = pgTable("forecast_Data", {
	id: uuid("id").defaultRandom().primaryKey(),
	customerArticleNo: text("customer_article_no"),
	dateRequested: timestamp("date_requested").defaultNow(),
	quantity: real("quantity"),
	requirementDate: timestamp("requirement_date").notNull(),
	article: integer("article"),
	createdAt: timestamp("created_at").defaultNow(),
});

export const forecastDataSchema = createSelectSchema(forecastData);
export const newForecastDataSchema = createInsertSchema(forecastData);

export type ForecastData = z.infer<typeof forecastDataSchema>;
export type NewForecastData = z.infer<typeof newForecastDataSchema>;
