/**
 * SyncEngine — Unified sync orchestrator
 *
 * ADR-0234: Single SyncEngine replaces 17+ scattered modules.
 * ADR-0235: ProviderAdapter interface for clean provider separation.
 *
 * Entry points: push(), pull(), reconcile()
 * Each provider (GitHub, JIRA, ADO) implements ProviderAdapter.
 */
import { type Platform, type PlatformSuffix } from './types.js';
import { type SyncPermissions } from './config.js';
export interface ExternalRef {
    platform: Platform;
    id: string;
    url: string;
    userStory: string;
}
export interface UserStoryData {
    id: string;
    title: string;
    description?: string;
    priority?: string;
    status?: string;
    acceptanceCriteria?: string[];
}
export interface FeatureData {
    id: string;
    title: string;
    externalRef?: {
        id: string;
        url?: string;
    };
}
export interface FieldChanges {
    title?: string;
    description?: string;
    status?: string;
    priority?: string;
    labels?: Label[];
}
export interface ExternalChange {
    type: 'status_change' | 'field_update' | 'comment' | 'created' | 'closed';
    ref: ExternalRef;
    data: Record<string, unknown>;
}
export interface ItemState {
    status: string;
    labels: string[];
    title: string;
    [key: string]: unknown;
}
export interface ExpectedState {
    ref: ExternalRef;
    expected: Partial<ItemState>;
}
export interface Label {
    name: string;
    color: string;
    description?: string;
}
export interface DetectedHierarchy {
    pattern: 'flat' | 'standard' | 'safe' | 'custom';
    levels: HierarchyLevel[];
}
export interface HierarchyLevel {
    externalType: string;
    specweaveMapping: 'feature' | 'user-story' | 'task' | 'skip';
}
export interface SyncResult {
    ref: ExternalRef;
    action: 'created' | 'updated' | 'closed';
}
export interface PullResult {
    changes: ExternalChange[];
    platform: Platform;
}
export interface ReconcileResult {
    created: number;
    updated: number;
    closed: number;
    errors: string[];
}
export interface ProviderAdapter {
    readonly platform: Platform;
    readonly suffix: PlatformSuffix;
    testConnection(): Promise<{
        ok: boolean;
        error?: string;
    }>;
    createIssue(story: UserStoryData, feature: FeatureData): Promise<ExternalRef>;
    updateIssue(ref: ExternalRef, changes: FieldChanges): Promise<void>;
    closeIssue(ref: ExternalRef, comment?: string): Promise<void>;
    reopenIssue(ref: ExternalRef): Promise<void>;
    pullChanges(since?: Date): Promise<ExternalChange[]>;
    getIssueState(ref: ExternalRef): Promise<ItemState>;
    applyLabels(ref: ExternalRef, labels: Label[]): Promise<void>;
    detectHierarchy(): Promise<DetectedHierarchy>;
    reconcile(items: ExpectedState[]): Promise<ReconcileResult>;
    generateLabels(config: LabelConfig): Label[];
}
export interface LabelConfig {
    priority: string;
    type: string;
    projectName: string;
}
/**
 * Generate standardized labels for an issue.
 * Replaces the old system that labeled everything "critical".
 */
export declare function generateLabels(config: LabelConfig): Label[];
export interface SyncEngineConfig {
    permissions: SyncPermissions;
}
interface PushRequest {
    userStory: UserStoryData;
    feature: FeatureData;
}
export declare class SyncEngine {
    private providers;
    private permissions;
    constructor(config: SyncEngineConfig);
    registerProvider(adapter: ProviderAdapter): void;
    getProvider(platform: Platform): ProviderAdapter | undefined;
    getRegisteredPlatforms(): Platform[];
    testConnection(platform: Platform): Promise<{
        ok: boolean;
        error?: string;
    }>;
    push(platform: Platform, request: PushRequest): Promise<SyncResult>;
    pull(platform: Platform, since?: Date): Promise<PullResult>;
    updateIssue(ref: ExternalRef, changes: FieldChanges): Promise<void>;
    closeIssue(ref: ExternalRef, comment?: string): Promise<void>;
    reconcile(platform: Platform, items: ExpectedState[]): Promise<ReconcileResult>;
    detectHierarchy(platform: Platform): Promise<DetectedHierarchy>;
    private requireProvider;
    private requirePermission;
}
export {};
//# sourceMappingURL=engine.d.ts.map