/**
 * GitHub Sync Wrapper
 *
 * Wraps GitHub sync operations with the SyncInterceptor for permission checks
 * and audit logging. This provides a consistent interface for all GitHub sync
 * operations while ensuring they go through the permission enforcement layer.
 *
 * Usage:
 * ```typescript
 * const wrapper = new GitHubSyncWrapper({
 *   client: GitHubClientV2.fromRepo(owner, repo),
 *   interceptor,
 *   logger
 * });
 *
 * // All operations now go through permission enforcement
 * const issue = await wrapper.createUserStoryIssue(params);
 * ```
 *
 * @module sync/github-sync-wrapper
 */
import { SyncInterceptor } from '../core/sync/sync-interceptor.js';
import { GitHubClientV2 } from '../../plugins/specweave/lib/integrations/github/github-client-v2.js';
import { GitHubIssue } from '../../plugins/specweave/lib/integrations/github/types.js';
import { Logger } from '../utils/logger.js';
/**
 * User story issue creation parameters
 */
export interface CreateUserStoryIssueParams {
    featureId: string;
    userStoryId: string;
    title: string;
    body: string;
    labels?: string[];
    milestone?: number | null;
}
/**
 * Wrapper options
 */
export interface GitHubSyncWrapperOptions {
    /**
     * GitHub client instance
     */
    client: GitHubClientV2;
    /**
     * Sync interceptor for permission checking
     */
    interceptor: SyncInterceptor;
    /**
     * Logger instance
     */
    logger?: Logger;
}
/**
 * Operation result with additional metadata
 */
export interface WrappedOperationResult<T> {
    /**
     * Whether the operation was allowed and succeeded
     */
    success: boolean;
    /**
     * The result of the operation (null if denied or failed)
     */
    result: T | null;
    /**
     * Reason for denial (if denied)
     */
    denialReason?: string;
    /**
     * Error message (if failed)
     */
    error?: string;
    /**
     * Duration of the operation in milliseconds
     */
    durationMs: number;
}
/**
 * GitHubSyncWrapper - Permission-enforced GitHub sync operations
 *
 * All GitHub sync operations pass through the SyncInterceptor which:
 * 1. Checks permissions before execution
 * 2. Logs all attempts (success, denied, error)
 * 3. Provides consistent error handling
 *
 * This wrapper does NOT modify the underlying GitHubClientV2 - it provides
 * a parallel interface that can be used when permission checking is needed.
 */
export declare class GitHubSyncWrapper {
    private readonly client;
    private readonly interceptor;
    private readonly logger;
    constructor(options: GitHubSyncWrapperOptions);
    /**
     * Create a GitHub issue for a user story
     *
     * @param params - Issue creation parameters
     * @returns Wrapped operation result
     */
    createUserStoryIssue(params: CreateUserStoryIssueParams): Promise<WrappedOperationResult<GitHubIssue>>;
    /**
     * Create a generic epic/increment issue
     *
     * @param title - Issue title
     * @param body - Issue body
     * @param milestone - Optional milestone number or string
     * @param labels - Issue labels
     * @returns Wrapped operation result
     */
    createEpicIssue(title: string, body: string, milestone?: number | string, labels?: string[]): Promise<WrappedOperationResult<GitHubIssue>>;
    /**
     * Update a GitHub issue body
     *
     * @param issueNumber - Issue number
     * @param body - New issue body
     * @param origin - Item origin (internal or external)
     * @returns Wrapped operation result
     */
    updateIssueBody(issueNumber: number, body: string, origin?: 'internal' | 'external'): Promise<WrappedOperationResult<void>>;
    /**
     * Close a GitHub issue
     *
     * @param issueNumber - Issue number
     * @param comment - Optional closing comment
     * @returns Wrapped operation result
     */
    closeIssue(issueNumber: number, comment?: string): Promise<WrappedOperationResult<void>>;
    /**
     * Reopen a GitHub issue
     *
     * @param issueNumber - Issue number
     * @param comment - Optional reopening comment
     * @returns Wrapped operation result
     */
    reopenIssue(issueNumber: number, comment?: string): Promise<WrappedOperationResult<void>>;
    /**
     * Add a comment to a GitHub issue
     *
     * @param issueNumber - Issue number
     * @param comment - Comment body
     * @param origin - Item origin
     * @returns Wrapped operation result
     */
    addComment(issueNumber: number, comment: string, origin?: 'internal' | 'external'): Promise<WrappedOperationResult<void>>;
    /**
     * Add labels to a GitHub issue
     *
     * @param issueNumber - Issue number
     * @param labels - Labels to add
     * @returns Wrapped operation result
     */
    addLabels(issueNumber: number, labels: string[]): Promise<WrappedOperationResult<void>>;
    /**
     * Get a GitHub issue (read-only, always allowed)
     *
     * @param issueNumber - Issue number
     * @returns Wrapped operation result
     */
    getIssue(issueNumber: number): Promise<WrappedOperationResult<GitHubIssue | null>>;
    /**
     * Search for an issue by title (read-only, always allowed)
     *
     * @param title - Title to search for
     * @returns Wrapped operation result
     */
    searchIssueByTitle(title: string): Promise<WrappedOperationResult<GitHubIssue | null>>;
    /**
     * Check if an operation would be allowed (pre-flight check)
     *
     * @param operation - Operation type
     * @param itemId - Item ID
     * @returns true if operation would be allowed
     */
    wouldAllow(operation: 'upsert-internal' | 'upsert-external' | 'update-status' | 'read', itemId: string): boolean;
    /**
     * Get the underlying client for operations that don't need interception
     * (e.g., already-checked operations in bulk workflows)
     */
    getClient(): GitHubClientV2;
    /**
     * Convert interceptor result to wrapped result
     */
    private toWrappedResult;
}
/**
 * Factory function to create GitHubSyncWrapper
 *
 * @param owner - Repository owner
 * @param repo - Repository name
 * @param interceptor - Sync interceptor
 * @param logger - Optional logger
 */
export declare function createGitHubSyncWrapper(owner: string, repo: string, interceptor: SyncInterceptor, logger?: Logger): GitHubSyncWrapper;
//# sourceMappingURL=github-sync-wrapper.d.ts.map