import { pgTable, bigint, timestamp, text, jsonb, } from 'drizzle-orm/pg-core'; import { relations, type InferSelectModel, type InferInsertModel } from 'drizzle-orm'; export type GuildSettings = InferSelectModel; export type GuildSettingsInsert = InferInsertModel; export interface GuildConfig { studentRole?: string; visitorRole?: string; colorRoles: string[]; welcomeChannelId?: string; welcomeMessage?: string; feedbackChannelId?: string; terminal?: { channelId: string; messageId: string; }; moderation: { cases: { dmOnWarn: boolean; logChannelId?: string; autoTimeoutThreshold?: number; }; }; } export const guildSettings = pgTable('guild_settings', { guildId: bigint('guild_id', { mode: 'bigint' }).primaryKey(), studentRoleId: bigint('student_role_id', { mode: 'bigint' }), visitorRoleId: bigint('visitor_role_id', { mode: 'bigint' }), colorRoleIds: jsonb('color_role_ids').$type().default([]), welcomeChannelId: bigint('welcome_channel_id', { mode: 'bigint' }), welcomeMessage: text('welcome_message'), feedbackChannelId: bigint('feedback_channel_id', { mode: 'bigint' }), terminalChannelId: bigint('terminal_channel_id', { mode: 'bigint' }), terminalMessageId: bigint('terminal_message_id', { mode: 'bigint' }), moderationLogChannelId: bigint('moderation_log_channel_id', { mode: 'bigint' }), moderationDmOnWarn: jsonb('moderation_dm_on_warn').$type().default(true), moderationAutoTimeoutThreshold: jsonb('moderation_auto_timeout_threshold').$type(), featureOverrides: jsonb('feature_overrides').$type>().default({}), createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(), updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(), }); export const guildSettingsRelations = relations(guildSettings, () => ({}));