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

import { authUsers } from "./auth_users"

export const taxTypes = pgTable("taxtypes", {
    id: bigint("id", { mode: "number" })
        .primaryKey()
        .generatedByDefaultAsIdentity(),

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

    label: text("label").notNull(),
    percentage: bigint("percentage", { mode: "number" }).notNull(),

    updatedAt: timestamp("updated_at", { withTimezone: true }),
    updatedBy: uuid("updated_by").references(() => authUsers.id),
})

export type TaxType = typeof taxTypes.$inferSelect
export type NewTaxType = typeof taxTypes.$inferInsert
