import type { JsonValue } from '../control-plane';
export interface PlatformUpdateDocument {
    version: string;
    channel: 'stable' | 'preview' | 'nightly';
    publishedAt: string;
    minimumSchema: number;
    maximumSchema: number;
    minimumVersion?: string;
    artifacts: Array<{
        platform: string;
        architecture: string;
        url: string;
        sha256: string;
        sizeBytes: number;
    }>;
    migrations: Array<{
        id: string;
        reversible: boolean;
        description: string;
    }>;
    releaseNotes?: string;
}
export interface TrustedUpdateKey {
    id: string;
    organizationId: string;
    name: string;
    algorithm: 'ed25519';
    publicKeyPem: string;
    fingerprint: string;
    revokedAt?: string;
    createdAt: string;
}
export interface PlatformUpdateManifest {
    id: string;
    organizationId: string;
    version: string;
    channel: PlatformUpdateDocument['channel'];
    publishedAt: string;
    keyId: string;
    digest: string;
    document: PlatformUpdateDocument;
    signature: string;
    verificationStatus: 'verified' | 'invalid' | 'revoked';
    compatibility: {
        compatible: boolean;
        reasons: string[];
    };
    createdAt: string;
}
export interface MaintenanceWindow {
    id: string;
    projectId: string;
    name: string;
    schedule: string;
    timezone: string;
    durationMinutes: number;
    allowedOperations: string[];
    requireApproval: boolean;
    enabled: boolean;
    createdAt: string;
    updatedAt: string;
}
export interface UpgradeCampaign {
    id: string;
    projectId: string;
    manifestId: string;
    windowId?: string;
    fromVersion: string;
    strategy: 'canary' | 'rolling';
    batchSize: number;
    healthGate: Record<string, JsonValue>;
    status: 'planned' | 'queued' | 'running' | 'paused' | 'rolling_back' | 'succeeded' | 'failed' | 'rolled_back' | 'cancelled';
    currentStage?: string;
    backupId?: string;
    approvedBy?: string;
    createdAt: string;
    updatedAt: string;
}
export interface UpgradeTarget {
    id: string;
    campaignId: string;
    serverId?: string;
    target: string;
    cohort: number;
    previousVersion: string;
    status: 'pending' | 'downloading' | 'installing' | 'healthy' | 'failed' | 'rolling_back' | 'rolled_back' | 'skipped';
    evidence: Record<string, JsonValue>;
    error?: string;
    startedAt?: string;
    finishedAt?: string;
    createdAt: string;
    updatedAt: string;
}
export interface CleanupCandidate {
    id: string;
    kind: string;
    label: string;
    bytes: number;
    metadata?: Record<string, JsonValue>;
}
export interface CleanupPlan {
    id: string;
    projectId: string;
    kind: 'releases' | 'artifacts' | 'operations' | 'logs' | 'previews' | 'snapshots' | 'orphaned_resources';
    criteria: Record<string, JsonValue>;
    candidates: CleanupCandidate[];
    candidateDigest: string;
    estimatedBytes: number;
    status: 'preview' | 'approved' | 'running' | 'succeeded' | 'partial' | 'failed' | 'expired';
    confirmation?: string;
    expiresAt: string;
    result: Record<string, JsonValue>;
    createdAt: string;
    updatedAt: string;
}
export interface DisasterRecoveryDrill {
    id: string;
    projectId: string;
    backupPolicyId?: string;
    recoveryPointId?: string;
    topologyId?: string;
    scenario: 'control_plane' | 'database' | 'volume' | 'regional';
    isolatedTarget: string;
    expectedRpoMinutes: number;
    expectedRtoMinutes: number;
    status: 'planned' | 'queued' | 'restoring' | 'verifying' | 'cleaning' | 'passed' | 'failed' | 'cleanup_required' | 'cancelled';
    operationId?: string;
    evidence: Record<string, JsonValue>;
    measuredRpoMinutes?: number;
    measuredRtoMinutes?: number;
    cleanupVerified: boolean;
    error?: string;
    startedAt?: string;
    finishedAt?: string;
    createdAt: string;
    updatedAt: string;
}
export interface PlatformMaintenanceDriver {
    download(input: {
        target: UpgradeTarget;
        artifact: PlatformUpdateDocument['artifacts'][number];
        signal: AbortSignal;
    }): Promise<{
        path: string;
        sha256: string;
    }>;
    install(input: {
        target: UpgradeTarget;
        path: string;
        version: string;
        signal: AbortSignal;
    }): Promise<void>;
    health(input: {
        target: UpgradeTarget;
        gate: Record<string, JsonValue>;
    }): Promise<{
        healthy: boolean;
        evidence: Record<string, JsonValue>;
    }>;
    rollback(input: {
        target: UpgradeTarget;
        version: string;
        signal: AbortSignal;
    }): Promise<void>;
}
export interface CleanupDriver {
    kind: CleanupPlan['kind'];
    discover(criteria: CleanupPlan['criteria']): Promise<CleanupCandidate[]>;
    remove(candidate: CleanupCandidate): Promise<void>;
}
export interface DisasterRecoveryDriver {
    scenario: DisasterRecoveryDrill['scenario'];
    restore(input: {
        drill: DisasterRecoveryDrill;
        signal: AbortSignal;
    }): Promise<{
        target: string;
        recoveryPointAt: string;
        evidence: Record<string, JsonValue>;
    }>;
    verify(input: {
        drill: DisasterRecoveryDrill;
        target: string;
    }): Promise<{
        healthy: boolean;
        evidence: Record<string, JsonValue>;
    }>;
    cleanup(input: {
        drill: DisasterRecoveryDrill;
        target: string;
    }): Promise<void>;
}
