//! Cloudflare deploy adapter trait (injected by CLI).
//!
//! The deploy engine stays free of Wrangler / CLI I/O; the CLI crate implements
//! this trait by calling the existing `xbp cloudflare deploy` workflow.
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
/// Request to deploy one service via Cloudflare Worker / Containers.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CloudflareServiceDeployRequest {
pub service_name: String,
/// Worker app name (`workers[].name`), defaults to service name when unset.
pub worker_app: String,
pub dry_run: bool,
/// `immediate` | `gradual` (or empty for worker default).
pub rollout: Option<String>,
pub skip_deploy: bool,
pub allow_unchanged_container_image: bool,
pub prune_old_images: bool,
/// Pre-build the container Dockerfile with local Docker before Wrangler deploy.
#[serde(default)]
pub local_build: bool,
/// Only run the local Docker build (no Wrangler deploy / registry push).
#[serde(default)]
pub local_build_only: bool,
}
/// Pluggable Cloudflare deploy backend.
#[async_trait]
pub trait CloudflareDeployAdapter: Send + Sync {
async fn deploy_service(
&self,
request: CloudflareServiceDeployRequest,
) -> Result<Vec<String>, String>;
}