import type { Db } from "@rudderhq/db";
import { issues, labels } from "@rudderhq/db";
import { type ReorderIssue } from "@rudderhq/shared";
import { type IssueWithLabels, type IssueWithLabelsAndRun, type IssueFilters } from "./issues.helpers.js";
export type { IssueFilters } from "./issues.helpers.js";
export { deriveIssueUserContext } from "./issues.helpers.js";
export declare function issueService(db: Db): {
    getAncestors: (issueId: string) => Promise<{
        project: {
            id: string;
            name: string;
            description: string | null;
            status: string;
            goalId: string | null;
            workspaces: Array<{
                id: string;
                orgId: string;
                projectId: string;
                name: string;
                cwd: string | null;
                repoUrl: string | null;
                repoRef: string | null;
                metadata: Record<string, unknown> | null;
                isPrimary: boolean;
                createdAt: Date;
                updatedAt: Date;
            }>;
            primaryWorkspace: {
                id: string;
                orgId: string;
                projectId: string;
                name: string;
                cwd: string | null;
                repoUrl: string | null;
                repoRef: string | null;
                metadata: Record<string, unknown> | null;
                isPrimary: boolean;
                createdAt: Date;
                updatedAt: Date;
            } | null;
        } | null;
        goal: {
            id: string;
            title: string;
            description: string | null;
            level: string;
            status: string;
        } | null;
        id: string;
        identifier: string | null;
        title: string;
        description: string | null;
        status: string;
        priority: string;
        assigneeAgentId: string | null;
        assigneeUserId: string | null;
        reviewerAgentId: string | null;
        reviewerUserId: string | null;
        projectId: string | null;
        goalId: string | null;
    }[]>;
    findMentionedAgents: (orgId: string, body: string) => Promise<string[]>;
    findMentionedProjectIds: (issueId: string) => Promise<string[]>;
    listComments: (issueId: string, opts?: {
        afterCommentId?: string | null;
        order?: "asc" | "desc";
        limit?: number | null;
    }) => Promise<{
        createdAt: Date;
        body: string;
        id: string;
        updatedAt: Date;
        orgId: string;
        issueId: string;
        authorAgentId: string | null;
        authorUserId: string | null;
    }[]>;
    getCommentCursor: (issueId: string) => Promise<{
        totalComments: number;
        latestCommentId: string;
        latestCommentAt: Date;
    }>;
    getComment: (commentId: string) => Promise<{
        createdAt: Date;
        body: string;
        id: string;
        updatedAt: Date;
        orgId: string;
        issueId: string;
        authorAgentId: string | null;
        authorUserId: string | null;
    } | null>;
    addComment: (issueId: string, body: string, actor: {
        agentId?: string;
        userId?: string;
    }) => Promise<{
        createdAt: Date;
        body: string;
        id: string;
        updatedAt: Date;
        orgId: string;
        issueId: string;
        authorAgentId: string | null;
        authorUserId: string | null;
    }>;
    createAttachment: (input: {
        issueId: string;
        issueCommentId?: string | null;
        usage?: string;
        provider: string;
        objectKey: string;
        contentType: string;
        byteSize: number;
        sha256: string;
        originalFilename?: string | null;
        createdByAgentId?: string | null;
        createdByUserId?: string | null;
    }) => Promise<{
        id: string;
        orgId: string;
        issueId: string;
        issueCommentId: string | null;
        assetId: string;
        usage: string;
        provider: string;
        objectKey: string;
        contentType: string;
        byteSize: number;
        sha256: string;
        originalFilename: string | null;
        createdByAgentId: string | null;
        createdByUserId: string | null;
        createdAt: Date;
        updatedAt: Date;
    }>;
    listAttachments: (issueId: string) => Promise<{
        id: string;
        orgId: string;
        issueId: string;
        issueCommentId: string | null;
        assetId: string;
        usage: string;
        provider: string;
        objectKey: string;
        contentType: string;
        byteSize: number;
        sha256: string;
        originalFilename: string | null;
        createdByAgentId: string | null;
        createdByUserId: string | null;
        createdAt: Date;
        updatedAt: Date;
    }[]>;
    getAttachmentById: (id: string) => Promise<{
        id: string;
        orgId: string;
        issueId: string;
        issueCommentId: string | null;
        assetId: string;
        usage: string;
        provider: string;
        objectKey: string;
        contentType: string;
        byteSize: number;
        sha256: string;
        originalFilename: string | null;
        createdByAgentId: string | null;
        createdByUserId: string | null;
        createdAt: Date;
        updatedAt: Date;
    }>;
    removeAttachment: (id: string) => Promise<{
        id: string;
        orgId: string;
        issueId: string;
        issueCommentId: string | null;
        assetId: string;
        usage: string;
        provider: string;
        objectKey: string;
        contentType: string;
        byteSize: number;
        sha256: string;
        originalFilename: string | null;
        createdByAgentId: string | null;
        createdByUserId: string | null;
        createdAt: Date;
        updatedAt: Date;
    } | null>;
    listFollows: (orgId: string, userId: string) => Promise<{
        id: string;
        orgId: string;
        issueId: string;
        userId: string;
        createdAt: Date;
        issue: {
            status: string;
            id: string;
            updatedAt: Date;
            identifier: string | null;
            title: string;
            createdByUserId: string | null;
            priority: string;
            assigneeAgentId: string | null;
            assigneeUserId: string | null;
            reviewerUserId: string | null;
        };
    }[]>;
    followIssue: (orgId: string, issueId: string, userId: string) => Promise<{
        createdAt: Date;
        id: string;
        userId: string;
        orgId: string;
        issueId: string;
    }>;
    unfollowIssue: (orgId: string, issueId: string, userId: string) => Promise<{
        createdAt: Date;
        id: string;
        userId: string;
        orgId: string;
        issueId: string;
    }>;
    isFollowedByUser: (orgId: string, issueId: string, userId: string) => Promise<boolean>;
    list: (orgId: string, filters?: IssueFilters) => Promise<IssueWithLabelsAndRun[]>;
    countUnreadTouchedByUser: (orgId: string, userId: string, status?: string) => Promise<number>;
    markRead: (orgId: string, issueId: string, userId: string, readAt?: Date) => Promise<{
        createdAt: Date;
        id: string;
        userId: string;
        updatedAt: Date;
        orgId: string;
        issueId: string;
        lastReadAt: Date;
    }>;
    getById: (id: string) => Promise<IssueWithLabels | null>;
    getByIdentifier: (identifier: string) => Promise<IssueWithLabels | null>;
    create: (orgId: string, data: Omit<typeof issues.$inferInsert, "orgId"> & {
        labelIds?: string[];
    }) => Promise<IssueWithLabels>;
    update: (id: string, data: Partial<typeof issues.$inferInsert> & {
        labelIds?: string[];
    }) => Promise<IssueWithLabels | null>;
    reorder: (orgId: string, input: ReorderIssue) => Promise<{
        issue: IssueWithLabels;
        previousStatus: string;
        previousBoardOrder: number;
    } | null>;
    remove: (id: string) => Promise<IssueWithLabels | null>;
    checkout: (id: string, agentId: string, expectedStatuses: string[], checkoutRunId: string | null) => Promise<{
        id: string;
        orgId: string;
        projectId: string | null;
        projectWorkspaceId: string | null;
        goalId: string | null;
        parentId: string | null;
        title: string;
        description: string | null;
        status: string;
        priority: string;
        boardOrder: number;
        assigneeAgentId: string | null;
        assigneeUserId: string | null;
        reviewerAgentId: string | null;
        reviewerUserId: string | null;
        checkoutRunId: string | null;
        executionRunId: string | null;
        executionAgentNameKey: string | null;
        executionLockedAt: Date | null;
        createdByAgentId: string | null;
        createdByUserId: string | null;
        issueNumber: number | null;
        identifier: string | null;
        originKind: string;
        originId: string | null;
        originRunId: string | null;
        requestDepth: number;
        billingCode: string | null;
        assigneeAgentRuntimeOverrides: Record<string, unknown> | null;
        executionWorkspaceId: string | null;
        executionWorkspacePreference: string | null;
        executionWorkspaceSettings: Record<string, unknown> | null;
        startedAt: Date | null;
        completedAt: Date | null;
        cancelledAt: Date | null;
        hiddenAt: Date | null;
        createdAt: Date;
        updatedAt: Date;
    }>;
    assertCheckoutOwner: (id: string, actorAgentId: string, actorRunId: string | null) => Promise<{
        adoptedFromRunId: string | null;
        id: string;
        status: string;
        assigneeAgentId: string | null;
        checkoutRunId: string | null;
    } | {
        adoptedFromRunId: string;
        id: string;
        status: string;
        assigneeAgentId: string | null;
        checkoutRunId: string | null;
        executionRunId: string | null;
    }>;
    release: (id: string, actorAgentId?: string, actorRunId?: string | null) => Promise<IssueWithLabels | null>;
    listLabels: (orgId: string) => Omit<import("drizzle-orm/pg-core").PgSelectBase<"labels", {
        id: import("drizzle-orm/pg-core").PgColumn<{
            name: "id";
            tableName: "labels";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: true;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        orgId: import("drizzle-orm/pg-core").PgColumn<{
            name: "org_id";
            tableName: "labels";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        name: import("drizzle-orm/pg-core").PgColumn<{
            name: "name";
            tableName: "labels";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        color: import("drizzle-orm/pg-core").PgColumn<{
            name: "color";
            tableName: "labels";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        createdAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "created_at";
            tableName: "labels";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        updatedAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "updated_at";
            tableName: "labels";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
    }, "single", Record<"labels", "not-null">, false, "where" | "orderBy", {
        createdAt: Date;
        id: string;
        name: string;
        updatedAt: Date;
        orgId: string;
        color: string;
    }[], {
        id: import("drizzle-orm/pg-core").PgColumn<{
            name: "id";
            tableName: "labels";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: true;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        orgId: import("drizzle-orm/pg-core").PgColumn<{
            name: "org_id";
            tableName: "labels";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        name: import("drizzle-orm/pg-core").PgColumn<{
            name: "name";
            tableName: "labels";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        color: import("drizzle-orm/pg-core").PgColumn<{
            name: "color";
            tableName: "labels";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        createdAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "created_at";
            tableName: "labels";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        updatedAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "updated_at";
            tableName: "labels";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
    }>, "where" | "orderBy">;
    getLabelById: (id: string) => Promise<{
        createdAt: Date;
        id: string;
        name: string;
        updatedAt: Date;
        orgId: string;
        color: string;
    }>;
    createLabel: (orgId: string, data: Pick<typeof labels.$inferInsert, "name" | "color">) => Promise<{
        createdAt: Date;
        id: string;
        name: string;
        updatedAt: Date;
        orgId: string;
        color: string;
    }>;
    updateLabel: (id: string, data: Partial<Pick<typeof labels.$inferInsert, "name" | "color">>) => Promise<{
        createdAt: Date;
        id: string;
        name: string;
        updatedAt: Date;
        orgId: string;
        color: string;
    } | null>;
    deleteLabel: (id: string) => Promise<{
        createdAt: Date;
        id: string;
        name: string;
        updatedAt: Date;
        orgId: string;
        color: string;
    }>;
};
//# sourceMappingURL=issues.d.ts.map