import { sqliteTable, text } from 'drizzle-orm/sqlite-core'
export * from './auth-schema'

import { user } from './auth-schema'

export const usersTable = sqliteTable('users', {
    id: text('id').references(() => user.id),
    username: text('username').notNull(),
    fullName: text('full_name'),
    email: text('email'),
})

export const accountsTable = sqliteTable('accounts', {
    userId: text('user_id').references(() => user.id),
    provider: text('provider').notNull(),
    username: text('username').notNull(),
})

export const poissonRequestsTable = sqliteTable('poisson_requests', {
    userId: text('user_id').references(() => usersTable.id),
    requestType: text('request_type').notNull(), // "link" or "create"
    comments: text('comments'), // contains username suggestions
})

export const appuntiTable = sqliteTable('appunti', {
    userId: text('user_id').references(() => usersTable.id),
    hash: text('hash').notNull(),
    link: text('link'),
    visibility: text('visibility').notNull(), // "public", "internal", "private"
    title: text('title').notNull(),
    description: text('description'),
    tags: text('tags').notNull(), // Array of strings, e.g. ["#geometria-2", "#511aa", "#2017-18", "#frigerio"]
})
