import {
    pgTable,
    uuid,
    timestamp,
    text,
    boolean,
    bigint,
} from "drizzle-orm/pg-core"

import { tenants } from "./tenants"

export const filetags = pgTable("filetags", {
    id: uuid("id").primaryKey().defaultRandom(),

    createdAt: timestamp("created_at", { withTimezone: true })
        .notNull()
        .defaultNow(),

    name: text("name").notNull(),
    color: text("color"),

    tenant: bigint("tenant", { mode: "number" })
        .notNull()
        .references(() => tenants.id),

    createdDocumentType: text("createddocumenttype").default(""),
    incomingDocumentType: text("incomingDocumentType"),

    isSystemUsed: boolean("isSystemUsed").notNull().default(false),

    archived: boolean("archived").notNull().default(false),
})

export type FileTag = typeof filetags.$inferSelect
export type NewFileTag = typeof filetags.$inferInsert
