//! Non-Windows stub. The supervisor's composition root only references
//! [`WindowsCellBackend`] inside a `#[cfg(target_os = "windows")]` block and
//! pins the dependency to the Windows target, so this stub exists purely so the
//! crate is a buildable workspace member on Linux/macOS CI (`cargo check
//! --workspace`, `cargo doc`). Every method fails closed.

use async_trait::async_trait;

use cellos_core::ports::{CellBackend, CellHandle, TeardownReport};
use cellos_core::{CellosError, ExecutionCellDocument};

const UNSUPPORTED: &str =
    "WindowsCellBackend is only supported on Windows (Job Object isolation); \
     compiled as a stub on this host";

/// Non-Windows stub for the Windows Job Object backend.
#[derive(Default)]
pub struct WindowsCellBackend;

impl WindowsCellBackend {
    pub fn new() -> Self {
        Self
    }
}

#[async_trait]
impl CellBackend for WindowsCellBackend {
    async fn create(&self, _spec: &ExecutionCellDocument) -> Result<CellHandle, CellosError> {
        Err(CellosError::Host(UNSUPPORTED.into()))
    }

    async fn destroy(&self, _handle: &CellHandle) -> Result<TeardownReport, CellosError> {
        Err(CellosError::Host(UNSUPPORTED.into()))
    }
}
