/**
 * Deployment Orchestrator Types
 *
 * Type definitions for the deployment orchestration pipeline that bridges
 * DigitalOcean provisioning with the Crewly node setup scripts.
 *
 * @module services/provisioning/deployment-orchestrator.types
 */
// ---------------------------------------------------------------------------
// Deployment Phases
// ---------------------------------------------------------------------------
/** Ordered phases of a full-stack deployment. */
export var DeploymentPhase;
(function (DeploymentPhase) {
    DeploymentPhase["CREATING_DROPLET"] = "CREATING_DROPLET";
    DeploymentPhase["WAITING_FOR_DROPLET"] = "WAITING_FOR_DROPLET";
    DeploymentPhase["PROVISIONING_BASE"] = "PROVISIONING_BASE";
    DeploymentPhase["INSTALLING_OSS"] = "INSTALLING_OSS";
    DeploymentPhase["INSTALLING_PRO"] = "INSTALLING_PRO";
    DeploymentPhase["CONFIGURING_ACCOUNT"] = "CONFIGURING_ACCOUNT";
    DeploymentPhase["CONNECTING_CLOUD"] = "CONNECTING_CLOUD";
    DeploymentPhase["READY"] = "READY";
    DeploymentPhase["FAILED"] = "FAILED";
})(DeploymentPhase || (DeploymentPhase = {}));
/** Phases in execution order (excludes terminal states). */
export const DEPLOYMENT_PHASE_ORDER = [
    DeploymentPhase.CREATING_DROPLET,
    DeploymentPhase.WAITING_FOR_DROPLET,
    DeploymentPhase.PROVISIONING_BASE,
    DeploymentPhase.INSTALLING_OSS,
    DeploymentPhase.INSTALLING_PRO,
    DeploymentPhase.CONFIGURING_ACCOUNT,
    DeploymentPhase.CONNECTING_CLOUD,
    DeploymentPhase.READY,
];
/**
 * Custom error for deployment failures with phase context.
 */
export class DeploymentError extends Error {
    /** Structured error code. */
    code;
    /** Phase where the failure occurred. */
    phase;
    /** Associated deployment ID. */
    deploymentId;
    constructor(code, message, phase, deploymentId) {
        super(message);
        this.name = 'DeploymentError';
        this.code = code;
        this.phase = phase;
        this.deploymentId = deploymentId;
    }
}
// ---------------------------------------------------------------------------
// Type Guards
// ---------------------------------------------------------------------------
/**
 * Check whether a string is a valid DeploymentPhase.
 *
 * @param value - Value to check
 * @returns True if value is a valid DeploymentPhase
 */
export function isDeploymentPhase(value) {
    return typeof value === 'string' && Object.values(DeploymentPhase).includes(value);
}
/**
 * Check whether a value is a DeploymentError.
 *
 * @param value - Value to check
 * @returns True if value is a DeploymentError
 */
export function isDeploymentError(value) {
    return value instanceof DeploymentError;
}
/**
 * Check whether a deployment phase is a terminal state.
 *
 * @param phase - Phase to check
 * @returns True if the phase is READY or FAILED
 */
export function isTerminalPhase(phase) {
    return phase === DeploymentPhase.READY || phase === DeploymentPhase.FAILED;
}
//# sourceMappingURL=deployment-orchestrator.types.js.map