/**
 * DigitalOcean Provisioning Service
 *
 * Wraps the DigitalOcean REST API v2 for automated Droplet lifecycle
 * management. Provides create, destroy, status, list, and wait-for-ready
 * operations with structured error handling.
 *
 * All API interactions use the native `fetch` API — no external HTTP
 * libraries required.
 *
 * @module services/provisioning/provisioning.service
 */
import { type ProvisioningServiceConfig, type CreateDropletConfig, type DropletInfo, type DropletStatus } from './provisioning.types.js';
/**
 * Service for managing DigitalOcean Droplets via the REST API v2.
 *
 * @example
 * ```typescript
 * const svc = new ProvisioningService({ apiToken: 'dop_v1_xxx' });
 * const droplet = await svc.createDroplet({ name: 'my-node' });
 * const ready = await svc.waitForDropletReady(droplet.id);
 * console.log(ready.networks); // [{ ipAddress: '...', type: 'public' }]
 * ```
 */
export declare class ProvisioningService {
    private readonly apiToken;
    private readonly defaultRegion;
    private readonly defaultSize;
    /**
     * Create a new ProvisioningService.
     *
     * @param config - Service configuration
     * @param config.apiToken - DigitalOcean personal access token
     * @param config.defaultRegion - Default region slug (defaults to nyc1)
     * @param config.defaultSize - Default size slug (defaults to s-2vcpu-4gb)
     */
    constructor(config: ProvisioningServiceConfig);
    /**
     * Create a new DigitalOcean Droplet.
     *
     * The Droplet is always tagged with the `crewly-pro` tag. Additional tags
     * may be specified via `config.tags`.
     *
     * @param config - Droplet creation configuration
     * @returns Normalized Droplet info after creation (status will be 'new')
     * @throws {ProvisioningError} On API failure
     *
     * @example
     * ```typescript
     * const info = await svc.createDroplet({
     *   name: 'worker-1',
     *   region: 'sfo3',
     *   userData: '#!/bin/bash\napt-get update',
     * });
     * ```
     */
    createDroplet(config: CreateDropletConfig): Promise<DropletInfo>;
    /**
     * Destroy (permanently delete) a Droplet by ID.
     *
     * @param dropletId - The Droplet ID to destroy
     * @throws {ProvisioningError} On API failure (e.g. NOT_FOUND)
     */
    destroyDroplet(dropletId: number): Promise<void>;
    /**
     * Get the current status of a Droplet.
     *
     * @param dropletId - The Droplet ID to query
     * @returns The Droplet's current status
     * @throws {ProvisioningError} On API failure
     */
    getDropletStatus(dropletId: number): Promise<DropletStatus>;
    /**
     * List Droplets, optionally filtered by tag.
     *
     * @param tag - Tag to filter by (defaults to listing all Droplets)
     * @returns Array of normalized Droplet info objects
     * @throws {ProvisioningError} On API failure
     */
    listDroplets(tag?: string): Promise<DropletInfo[]>;
    /**
     * Poll until a Droplet reaches the 'active' status.
     *
     * @param dropletId - The Droplet ID to watch
     * @param timeoutMs - Maximum time to wait in milliseconds (default: 300s)
     * @returns Normalized Droplet info once active
     * @throws {ProvisioningError} With code 'TIMEOUT' if the Droplet does not
     *   become active within the timeout period
     *
     * @example
     * ```typescript
     * const ready = await svc.waitForDropletReady(droplet.id, 60_000);
     * ```
     */
    waitForDropletReady(dropletId: number, timeoutMs?: number): Promise<DropletInfo>;
    /**
     * Make an authenticated request to the DigitalOcean API.
     *
     * @param path - API path (e.g. '/droplets')
     * @param method - HTTP method
     * @param body - Optional request body (will be JSON-serialized)
     * @returns Parsed JSON response body
     * @throws {ProvisioningError} On HTTP errors or network failures
     */
    private doRequest;
    /**
     * Map an HTTP error response to a structured ProvisioningError.
     *
     * @param response - The failed fetch Response
     * @throws {ProvisioningError} Always throws
     */
    private handleErrorResponse;
    /**
     * Map an HTTP status code to a ProvisioningErrorCode.
     *
     * @param status - HTTP status code
     * @returns Corresponding error code
     */
    private mapHttpStatusToErrorCode;
    /**
     * Normalize a raw DO API Droplet object into our DropletInfo shape.
     *
     * @param raw - Raw Droplet from the DO API
     * @returns Normalized DropletInfo
     */
    private normalizeDroplet;
    /**
     * Sleep for a given number of milliseconds.
     *
     * @param ms - Duration in milliseconds
     * @returns Promise that resolves after the delay
     */
    private sleep;
}
//# sourceMappingURL=provisioning.service.d.ts.map