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

import { tenants } from "./tenants"
import { authUsers } from "./auth_users"

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

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

    institutionId: text("institutionId"),

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

    status: text("status"),

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

export type BankRequisition = typeof bankrequisitions.$inferSelect
export type NewBankRequisition = typeof bankrequisitions.$inferInsert
