use rig::tool::Tool;

use crate::Error;

#[derive(Clone)]
pub struct ToolWrapper<T: Tool + 'static>(Box<T>);

impl<T: Tool + 'static> ToolWrapper<T> {
    pub fn new(tool: T) -> Self {
        Self(Box::new(tool))
    }
    pub fn tool(self) -> Box<T> {
        self.0
    }
}

pub struct NoTool;

impl Tool for NoTool {
    const NAME: &'static str = "";

    type Error = Error;
    type Args = ();
    type Output = ();

    async fn definition(&self, _prompt: String) -> rig::completion::ToolDefinition {
        unreachable!("NoTool should never be used");
    }

    async fn call(&self, _args: Self::Args) -> Result<Self::Output, Self::Error> {
        unreachable!("NoTool should never be used");
    }
}
