import { boolean, integer, jsonb, numeric, pgSchema, text, timestamp, uuid, varchar } from "drizzle-orm/pg-core"; import type { CatalogBaseStat } from "@/lib/translator/types"; export const catalogSchema = pgSchema("catalog"); export const guidesSchema = pgSchema("guides"); export const catalogCharacters = catalogSchema.table("character", { key: varchar("key", { length: 64 }).primaryKey(), name: text("name").notNull(), element: varchar("element", { length: 48 }), rarity: integer("rarity"), weaponType: varchar("weapon_type", { length: 64 }), imageKey: text("image_key").notNull(), baseStats: jsonb("base_stats").$type().default([]).notNull(), }); export const catalogWeapons = catalogSchema.table("weapon", { key: varchar("key", { length: 64 }).primaryKey(), name: text("name").notNull(), rarity: integer("rarity"), weaponType: varchar("weapon_type", { length: 64 }), imageKey: text("image_key").notNull(), }); export const catalogArtifacts = catalogSchema.table("artifact", { key: varchar("key", { length: 64 }).primaryKey(), name: text("name").notNull(), rarity: integer("rarity"), imageKey: text("image_key").notNull(), }); export const guides = guidesSchema.table("guide", { id: uuid("id").primaryKey(), characterKey: varchar("character_key", { length: 64 }).notNull(), name: text("name").notNull(), sortOrder: integer("sort_order").notNull(), isPublic: boolean("is_public").notNull(), trashedAt: timestamp("trashed_at", { withTimezone: true }), }); export const teamConditions = guidesSchema.table("team_condition", { id: uuid("id").primaryKey(), guideId: uuid("guide_id").notNull(), name: varchar("name", { length: 255 }), sortOrder: integer("sort_order").notNull(), }); export const teamCompositions = guidesSchema.table("team_composition", { id: uuid("id").primaryKey(), guideId: uuid("guide_id").notNull(), title: text("title").notNull(), combo: text("combo").notNull(), sortOrder: integer("sort_order").notNull(), conditionId: uuid("condition_id"), rotationSeconds: numeric("rotation_seconds").notNull(), }); export const teamMembers = guidesSchema.table("team_member", { teamId: uuid("team_id").notNull(), position: integer("position").notNull(), characterKey: varchar("character_key", { length: 64 }).notNull(), weaponKey: varchar("weapon_key", { length: 64 }).notNull(), artifactKey: varchar("artifact_key", { length: 64 }).notNull(), secondArtifactKey: varchar("second_artifact_key", { length: 64 }), constellation: integer("constellation").notNull(), refinement: integer("refinement").notNull(), });