import type { ControlPlaneOperation, ControlPlaneStore, JsonValue } from '../control-plane';
import { DurableOperationQueue } from '../queue';
export * from './ssh-driver';
export * from './queue';
export type ServerProvider = 'aws' | 'hetzner' | 'ssh';
export type ServerRole = 'application' | 'build' | 'worker' | 'monitoring' | 'backup' | 'control_plane';
export interface ServerFacts {
    os?: string;
    arch?: string;
    cpuCores?: number;
    memoryBytes?: number;
    diskBytes?: number;
    diskFreeBytes?: number;
    dnsOk?: boolean;
    timeSkewSeconds?: number;
    tools?: Record<string, string>;
    ports?: number[];
    privilege?: string;
    proxyVersion?: string;
    runtimeVersions?: Record<string, string>;
    firewall?: string;
    network?: Record<string, JsonValue>;
}
export interface ValidationFinding {
    code: string;
    severity: 'info' | 'warning' | 'error';
    message: string;
    remediation?: string;
}
export interface ServerValidation {
    valid: boolean;
    facts: ServerFacts;
    findings: ValidationFinding[];
    validatedAt: string;
    validatorVersion: string;
}
export interface FleetServer {
    id: string;
    organizationId: string;
    projectId: string;
    resourceId: string;
    name: string;
    provider: ServerProvider;
    providerId?: string;
    region?: string;
    zone?: string;
    endpoint: string;
    sshUser: string;
    sshPort: number;
    credentialRef: string;
    hostKeyAlgorithm?: string;
    hostKeyFingerprint?: string;
    pendingHostKey?: string;
    roles: ServerRole[];
    labels: Record<string, string>;
    taints: string[];
    capacity: Record<string, number>;
    usage: Record<string, number>;
    capabilities: Record<string, {
        supported: boolean;
        reason?: string;
    }>;
    status: 'pending' | 'validating' | 'ready' | 'degraded' | 'unreachable' | 'draining' | 'drained' | 'archived';
    trustState: 'unverified' | 'pinned' | 'rotation_pending' | 'blocked';
    validation?: ServerValidation;
    bootstrapVersion?: string;
    heartbeatAt?: string;
    lastSeenAt?: string;
    archivedAt?: string;
    version: number;
    createdAt: string;
    updatedAt: string;
}
export interface FleetDriver {
    provider: ServerProvider;
    discover(projectId: string): Promise<Array<{
        providerId: string;
        name: string;
        endpoint: string;
        region?: string;
        zone?: string;
    }>>;
    test(server: FleetServer): Promise<{
        reachable: boolean;
        hostKeyAlgorithm: string;
        hostKeyFingerprint: string;
        latencyMs: number;
    }>;
    validate(server: FleetServer): Promise<ServerFacts>;
    bootstrap(server: FleetServer, steps: string[]): Promise<{
        version: string;
    }>;
    capabilities(server?: FleetServer): FleetServer['capabilities'];
}
export declare class FleetStore {
    readonly control: ControlPlaneStore;
    private now;
    private id;
    constructor(control: ControlPlaneStore, now?: () => Date, id?: () => string);
    get(id: string): FleetServer | undefined;
    list(projectId: string, includeArchived?: boolean): FleetServer[];
    findProvider(organizationId: string, provider: ServerProvider, providerId: string): FleetServer | undefined;
    create(input: Omit<FleetServer, 'id' | 'version' | 'createdAt' | 'updatedAt'>): FleetServer;
    update(id: string, patch: Partial<FleetServer>): FleetServer;
}
export interface FleetBootstrapResult {
    preview: boolean;
    steps: string[];
    operation?: ControlPlaneOperation;
}
export declare class FleetService {
    readonly store: FleetStore;
    readonly drivers: FleetDriver[];
    private now;
    readonly queue: DurableOperationQueue;
    constructor(store: FleetStore, drivers: FleetDriver[], queue?: DurableOperationQueue, now?: () => Date);
    private driver;
    enroll(input: {
        organizationId: string;
        projectId: string;
        name: string;
        provider: ServerProvider;
        providerId?: string;
        region?: string;
        zone?: string;
        endpoint: string;
        sshUser: string;
        sshPort?: number;
        credentialRef: string;
        roles: ServerRole[];
        labels?: Record<string, string>;
    }): FleetServer;
    test(id: string): Promise<FleetServer>;
    reviewHostKey(id: string, fingerprint: string): FleetServer;
    validate(id: string): Promise<FleetServer>;
    bootstrap(id: string, confirmed?: boolean): FleetBootstrapResult;
    heartbeat(id: string, input: {
        usage: Record<string, number>;
        capabilities?: FleetServer['capabilities'];
    }): FleetServer;
    drain(id: string, drained?: boolean): FleetServer;
    uncordon(id: string): FleetServer;
    archive(id: string, confirmation: string): FleetServer;
}
