import { pgTable, bigserial, bigint, text, integer } from "drizzle-orm/pg-core";
import { magicPlanWindow } from "./window";

export const magicPlanWindowVentilation = pgTable(
  "magic_plan_window_ventilation",
  {
    id:                 bigserial("id", { mode: "bigint" }).primaryKey(),
    windowId:           bigint("magic_plan_window_id", { mode: "bigint" })
      .notNull()
      .unique()
      .references(() => magicPlanWindow.id, { onDelete: "cascade" }),
    openingType:        text("opening_type"),
    numOpenings:        integer("num_openings"),
    pctOpenable:        integer("pct_openable"),
    trickleVentAreaMm2: integer("trickle_vent_area_mm2"),
    numTrickleVents:    integer("num_trickle_vents"),
  },
);
