import { index, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
import { agents } from "./agents.js";
import { approvals } from "./approvals.js";
import { organizations } from "./organizations.js";
export const approvalComments = pgTable("approval_comments", {
    id: uuid("id").primaryKey().defaultRandom(),
    orgId: uuid("org_id").notNull().references(() => organizations.id),
    approvalId: uuid("approval_id").notNull().references(() => approvals.id),
    authorAgentId: uuid("author_agent_id").references(() => agents.id),
    authorUserId: text("author_user_id"),
    body: text("body").notNull(),
    createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
    updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
}, (table) => ({
    orgIdx: index("approval_comments_company_idx").on(table.orgId),
    approvalIdx: index("approval_comments_approval_idx").on(table.approvalId),
    approvalCreatedIdx: index("approval_comments_approval_created_idx").on(table.approvalId, table.createdAt),
    orgApprovalCreatedIdx: index("approval_comments_company_approval_created_idx").on(table.orgId, table.approvalId, table.createdAt),
    orgCreatedIdx: index("approval_comments_company_created_idx").on(table.orgId, table.createdAt),
}));
//# sourceMappingURL=approval_comments.js.map