import type { Db } from "@rudderhq/db";
import type { CreateAutomation, CreateAutomationTrigger, Automation, AutomationDetail, AutomationListItem, AutomationRunSummary, AutomationTrigger, AutomationTriggerSecretMaterial, RunAutomation, UpdateAutomation, UpdateAutomationTrigger } from "@rudderhq/shared";
import { type IssueAssignmentWakeupDeps } from "./issue-assignment-wakeup.js";
type Actor = {
    agentId?: string | null;
    userId?: string | null;
};
export declare function automationService(db: Db, deps?: {
    heartbeat?: IssueAssignmentWakeupDeps;
}): {
    get: (id: string) => Promise<{
        createdAt: Date;
        status: string;
        id: string;
        description: string | null;
        updatedAt: Date;
        orgId: string;
        title: string;
        projectId: string | null;
        goalId: string | null;
        createdByAgentId: string | null;
        createdByUserId: string | null;
        priority: string;
        assigneeAgentId: string;
        updatedByAgentId: string | null;
        updatedByUserId: string | null;
        parentIssueId: string | null;
        outputMode: string;
        chatConversationId: string | null;
        concurrencyPolicy: string;
        catchUpPolicy: string;
        lastTriggeredAt: Date | null;
        lastEnqueuedAt: Date | null;
    }>;
    getTrigger: (id: string) => Promise<{
        createdAt: Date;
        kind: string;
        id: string;
        updatedAt: Date;
        orgId: string;
        secretId: string | null;
        createdByAgentId: string | null;
        createdByUserId: string | null;
        nextRunAt: Date | null;
        enabled: boolean;
        updatedByAgentId: string | null;
        updatedByUserId: string | null;
        label: string | null;
        automationId: string;
        cronExpression: string | null;
        timezone: string | null;
        lastFiredAt: Date | null;
        publicId: string | null;
        signingMode: string | null;
        replayWindowSec: number | null;
        lastRotatedAt: Date | null;
        lastResult: string | null;
    }>;
    list: (orgId: string) => Promise<AutomationListItem[]>;
    getDetail: (id: string) => Promise<AutomationDetail | null>;
    create: (orgId: string, input: CreateAutomation, actor: Actor) => Promise<Automation>;
    update: (id: string, patch: UpdateAutomation, actor: Actor) => Promise<Automation | null>;
    delete: (id: string) => Promise<Automation | null>;
    createTrigger: (automationId: string, input: CreateAutomationTrigger, actor: Actor) => Promise<{
        trigger: AutomationTrigger;
        secretMaterial: AutomationTriggerSecretMaterial | null;
    }>;
    updateTrigger: (id: string, patch: UpdateAutomationTrigger, actor: Actor) => Promise<AutomationTrigger | null>;
    deleteTrigger: (id: string) => Promise<boolean>;
    rotateTriggerSecret: (id: string, actor: Actor) => Promise<{
        trigger: AutomationTrigger;
        secretMaterial: AutomationTriggerSecretMaterial;
    }>;
    runAutomation: (id: string, input: RunAutomation) => Promise<{
        createdAt: Date;
        status: string;
        id: string;
        updatedAt: Date;
        orgId: string;
        source: string;
        idempotencyKey: string | null;
        completedAt: Date | null;
        automationId: string;
        triggerId: string | null;
        triggeredAt: Date;
        triggerPayload: Record<string, unknown> | null;
        linkedIssueId: string | null;
        linkedChatConversationId: string | null;
        startedChatMessageId: string | null;
        terminalChatMessageId: string | null;
        lastChatMessageId: string | null;
        coalescedIntoRunId: string | null;
        failureReason: string | null;
    }>;
    firePublicTrigger: (publicId: string, input: {
        authorizationHeader?: string | null;
        signatureHeader?: string | null;
        timestampHeader?: string | null;
        idempotencyKey?: string | null;
        rawBody?: Buffer | null;
        payload?: Record<string, unknown> | null;
    }) => Promise<{
        createdAt: Date;
        status: string;
        id: string;
        updatedAt: Date;
        orgId: string;
        source: string;
        idempotencyKey: string | null;
        completedAt: Date | null;
        automationId: string;
        triggerId: string | null;
        triggeredAt: Date;
        triggerPayload: Record<string, unknown> | null;
        linkedIssueId: string | null;
        linkedChatConversationId: string | null;
        startedChatMessageId: string | null;
        terminalChatMessageId: string | null;
        lastChatMessageId: string | null;
        coalescedIntoRunId: string | null;
        failureReason: string | null;
    }>;
    listRuns: (automationId: string, limit?: number) => Promise<AutomationRunSummary[]>;
    tickScheduledTriggers: (now?: Date) => Promise<{
        triggered: number;
    }>;
    syncRunStatusForIssue: (issueId: string) => Promise<{
        id: string;
        orgId: string;
        automationId: string;
        triggerId: string | null;
        source: string;
        status: string;
        triggeredAt: Date;
        idempotencyKey: string | null;
        triggerPayload: Record<string, unknown> | null;
        linkedIssueId: string | null;
        linkedChatConversationId: string | null;
        startedChatMessageId: string | null;
        terminalChatMessageId: string | null;
        lastChatMessageId: string | null;
        coalescedIntoRunId: string | null;
        failureReason: string | null;
        completedAt: Date | null;
        createdAt: Date;
        updatedAt: Date;
    } | null>;
};
export {};
//# sourceMappingURL=automations.d.ts.map