// src/server/features/system/db/role_colors.table.ts
// Role colors table schema for dynamic note color settings per role

import { mysqlTable, varchar, timestamp, uniqueIndex } from 'drizzle-orm/mysql-core';

/**
 * Role colors table - stores dynamic note color palettes per role.
 */
export const roleColorsTable = mysqlTable('role_colors', {
  id: varchar('id', { length: 36 }).primaryKey().$defaultFn(() => crypto.randomUUID()),
  role: varchar('role', { length: 50 }).notNull().unique(),
  privateNormal: varchar('private_normal', { length: 7 }).notNull(),
  privateHigh: varchar('private_high', { length: 7 }).notNull(),
  publicNormal: varchar('public_normal', { length: 7 }).notNull(),
  publicHigh: varchar('public_high', { length: 7 }).notNull(),
  createdAt: timestamp('created_at').notNull().defaultNow(),
  updatedAt: timestamp('updated_at').notNull().defaultNow().onUpdateNow(),
}, (table) => ({
  uniqueRole: uniqueIndex('unique_role_colors_role').on(table.role),
}));

