//! {{name}} - Sensor Driver
//!
//! Auto-generated driver template.

use anyhow::Result;
use mecha10_core::Driver;
use serde::{Deserialize, Serialize};
use tracing::info;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct {{PascalName}}Config {
    pub update_rate_hz: f64,
}

pub struct {{PascalName}} {
    config: {{PascalName}}Config,
}

impl {{PascalName}} {
    pub fn new(config: {{PascalName}}Config) -> Self {
        Self { config }
    }
}

#[async_trait::async_trait]
impl Driver for {{PascalName}} {
    async fn initialize(&mut self) -> Result<()> {
        info!("Initializing {{name}} driver");
        // TODO: Initialize hardware/sensor
        Ok(())
    }

    async fn update(&mut self) -> Result<()> {
        // TODO: Read sensor data
        // TODO: Publish to message bus
        Ok(())
    }

    async fn shutdown(&mut self) -> Result<()> {
        info!("Shutting down {{name}} driver");
        Ok(())
    }
}
