import { real, sqliteTable, text } from "drizzle-orm/sqlite-core"; import type { BreakerTripCharacteristic, FuseUtilizationCategory, ProtectionDeviceType, RcdType, } from "../../shared/constants/protection-device.js"; import { distributionBoardComponents } from "./distribution-board-components.js"; export const distributionBoardComponentProtectionDevices = sqliteTable( "distribution_board_component_protection_devices", { componentId: text("component_id") .primaryKey() .references(() => distributionBoardComponents.id, { onDelete: "cascade", }), type: text("type").$type().notNull(), ratedCurrentA: real("rated_current_a").notNull(), fuseUtilizationCategory: text( "fuse_utilization_category" ).$type(), tripCharacteristic: text( "trip_characteristic" ).$type(), rcdType: text("rcd_type").$type(), ratedResidualCurrentMa: real("rated_residual_current_ma"), } );