import { bigint, bigserial, integer, pgTable } from "drizzle-orm/pg-core";
import { propertyConditionSurvey } from "./property_condition_survey";
import { elementType } from "./element_type";
import { InferInsertModel, InferSelectModel } from "drizzle-orm";

export const element = pgTable("element", {
  id: bigserial("id", { mode: "bigint" }).primaryKey(),

  surveyId: bigint("survey_id", { mode: "number" })
    .notNull()
    .references(() => propertyConditionSurvey.id),

  elementType: elementType("element_type").notNull(),
  elementInstance: integer("element_instance").notNull(),
});

export type ElementRow = InferSelectModel<typeof element>;
export type NewElementRow = InferInsertModel<typeof element>;

