/**
 * Jira Spec Sync
 *
 * CORRECT ARCHITECTURE:
 * - Syncs .specweave/docs/internal/specs/spec-*.md ↔ Jira Epics
 * - NOT increments ↔ Jira Issues (that was wrong!)
 *
 * Mapping:
 * - Spec → Jira Epic
 * - User Story → Jira Story (subtask of epic)
 * - Acceptance Criteria → Checklist in Story description
 *
 * @module jira-spec-sync
 */
import { UserStory, SpecSyncResult } from '../../../../../src/core/types/spec-metadata.js';
import { AdfDocument } from './content-format-adapter.js';
import { CircuitBreakerRegistry } from '../../../../../src/core/sync/circuit-breaker-registry.js';
import { SyncRetryQueue } from '../../../../../src/core/sync/sync-retry-queue.js';
/**
 * Build a JIRA story description from a UserStory.
 * ACs are rendered as [ ]/[x] which content-format-adapter converts to native ADF taskList/taskItem checkboxes.
 */
export declare function buildStoryDescription(us: UserStory): string;
export interface JiraEpic {
    id: string;
    key: string;
    summary: string;
    description: string | AdfDocument;
    status: {
        name: string;
    };
    url: string;
}
export interface JiraStory {
    id: string;
    key: string;
    summary: string;
    description: string;
    status: {
        name: string;
    };
    epicLink?: string;
    labels: string[];
}
export interface JiraConfig {
    domain: string;
    email: string;
    apiToken: string;
    projectKey: string;
}
export interface JiraSpecSyncOptions {
    circuitBreakerRegistry?: CircuitBreakerRegistry;
    retryQueue?: SyncRetryQueue;
    lockDir?: string;
    incrementId?: string;
    featureId?: string;
}
export declare class JiraSpecSync {
    private specManager;
    private client;
    private config;
    private projectRoot;
    private circuitBreakerRegistry?;
    private retryQueue?;
    private lockManager?;
    private incrementId;
    private featureId;
    constructor(config: JiraConfig, projectRoot?: string, projectId?: string, options?: JiraSpecSyncOptions);
    /**
     * Execute fn under file lock (if lockManager configured).
     */
    private withLock;
    /**
     * Check circuit breaker before making API calls.
     */
    private checkCircuitBreaker;
    /**
     * Record success on circuit breaker.
     */
    private recordApiSuccess;
    /**
     * Record failure on circuit breaker and optionally enqueue retry.
     */
    private recordApiFailure;
    /**
     * Initialize: detect deployment type and update client baseURL
     */
    init(): Promise<void>;
    /**
     * Sync spec to Jira Epic (CREATE or UPDATE)
     */
    syncSpecToJira(specId: string): Promise<SpecSyncResult>;
    /**
     * Sync FROM Jira Epic to spec (bidirectional)
     */
    syncFromJira(specId: string): Promise<SpecSyncResult>;
    /**
     * Create new Jira Epic for spec
     */
    private createJiraEpic;
    /**
     * Update existing Jira Epic
     */
    private updateJiraEpic;
    /**
     * Sync user stories as Jira Stories
     */
    private syncUserStories;
    /**
     * Write JIRA story key back to living doc US file frontmatter.
     * Searches all project subdirs for the matching US file and adds external_tools.jira.key.
     */
    private writeJiraKeyToUSFile;
    /**
     * Generate epic description from spec
     */
    private generateEpicDescription;
    /**
     * Generate story description from user story
     */
    private generateStoryDescription;
    /**
     * Detect conflicts between spec and Jira
     */
    private detectConflicts;
    /**
     * Resolve conflicts based on configurable strategy.
     *
     * Strategies:
     * - 'manual' (default): Halt sync, report conflicts to user, no auto-resolve
     * - 'remote-wins': Auto-resolve in favor of JIRA (remote)
     * - 'local-wins': Auto-resolve in favor of spec (local)
     * - 'report-only': Log conflicts, continue without resolving
     */
    private resolveConflicts;
    /**
     * Write conflict report JSON file for detected conflicts.
     */
    private writeConflictReport;
    /**
     * Fetch Jira Epic details
     */
    private fetchJiraEpic;
    /**
     * Find story by title pattern scoped to a specific spec (via label).
     * US IDs like "US-001" are reused across features, so we must scope to
     * the spec label (e.g. "spec:FS-526") to avoid false matches.
     */
    private findStoryByTitle;
    /**
     * Create Jira Story
     */
    private createStory;
    /**
     * Update Jira Story
     */
    private updateStory;
    /**
     * Transition issue to new status
     */
    private transitionIssue;
    /**
     * Resolve the actual issue type name available in this project.
     * Falls back through preferred → alternatives if the preferred type doesn't exist.
     */
    private resolveIssueType;
    /**
     * Map SpecWeave priority to JIRA priority name
     *
     * JIRA standard priority names: Highest, High, Medium, Low, Lowest
     */
    private mapPriorityToJira;
    /**
     * Map SpecWeave type to JIRA issue type
     *
     * Supports: Epic, Story, Bug, Task
     */
    private mapTypeToJira;
}
//# sourceMappingURL=jira-spec-sync.d.ts.map