import { index, pgTable, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
import { issues } from "./issues.js";
import { organizations } from "./organizations.js";
export const issueReadStates = pgTable("issue_read_states", {
    id: uuid("id").primaryKey().defaultRandom(),
    orgId: uuid("org_id").notNull().references(() => organizations.id),
    issueId: uuid("issue_id").notNull().references(() => issues.id),
    userId: text("user_id").notNull(),
    lastReadAt: timestamp("last_read_at", { withTimezone: true }).notNull().defaultNow(),
    createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
    updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
}, (table) => ({
    companyIssueIdx: index("issue_read_states_company_issue_idx").on(table.orgId, table.issueId),
    companyUserIdx: index("issue_read_states_company_user_idx").on(table.orgId, table.userId),
    companyIssueUserUnique: uniqueIndex("issue_read_states_company_issue_user_idx").on(table.orgId, table.issueId, table.userId),
}));
//# sourceMappingURL=issue_read_states.js.map