import type { Db } from "@rudderhq/db";
import type { Automation, AutomationDetail, AutomationListItem, AutomationRunSummary, AutomationTrigger, AutomationTriggerSecretMaterial, CreateAutomation, CreateAutomationTrigger, RunAutomation, UpdateAutomation, UpdateAutomationTrigger } from "@rudderhq/shared";
import type { StorageService } from "../storage/types.js";
import { chatAssistantService } from "./chat-assistant.js";
import { type IssueAssignmentWakeupDeps } from "./issue-assignment-wakeup.js";
type Actor = {
    agentId?: string | null;
    userId?: string | null;
};
type ChatAssistantService = ReturnType<typeof chatAssistantService>;
type AutomationServiceDeps = {
    heartbeat?: IssueAssignmentWakeupDeps;
    chatAssistant?: Pick<ChatAssistantService, "enrichConversation" | "streamChatAssistantReply">;
    storage?: StorageService;
    autoStartChatOutputRuns?: boolean;
};
export declare function automationService(db: Db, deps?: AutomationServiceDeps): {
    get: (id: string) => Promise<{
        id: string;
        orgId: string;
        description: string | null;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        createdByAgentId: string | null;
        createdByUserId: string | null;
        updatedByAgentId: string | null;
        updatedByUserId: string | null;
        title: string;
        priority: string;
        assigneeAgentId: string;
        projectId: string | null;
        goalId: string | null;
        parentIssueId: string | null;
        concurrencyPolicy: string;
        catchUpPolicy: string;
        outputMode: string;
        chatConversationId: string | null;
        notifyOnIssueCreated: boolean;
        notifyOnIssueCreatedUserId: string | null;
        lastTriggeredAt: Date | null;
        lastEnqueuedAt: Date | null;
    }>;
    getTrigger: (id: string) => Promise<{
        automationId: string;
        id: string;
        orgId: string;
        kind: string;
        createdAt: Date;
        updatedAt: Date;
        label: string | null;
        enabled: boolean;
        cronExpression: string | null;
        timezone: string | null;
        nextRunAt: Date | null;
        lastFiredAt: Date | null;
        publicId: string | null;
        secretId: string | null;
        signingMode: string | null;
        replayWindowSec: number | null;
        lastRotatedAt: Date | null;
        lastResult: string | null;
        createdByAgentId: string | null;
        createdByUserId: string | null;
        updatedByAgentId: string | null;
        updatedByUserId: string | null;
    }>;
    executeChatOutputAutomationRun: (runId: string) => Promise<void>;
    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<{
        automationId: string;
        id: string;
        orgId: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        completedAt: Date | null;
        source: string;
        idempotencyKey: string | null;
        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<{
        automationId: string;
        id: string;
        orgId: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        completedAt: Date | null;
        source: string;
        idempotencyKey: string | null;
        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<{
        automationId: string;
        id: string;
        orgId: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        completedAt: Date | null;
        source: string;
        idempotencyKey: string | null;
        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;
    } | null>;
};
export {};
//# sourceMappingURL=automations.d.ts.map