// Typed response types
#[derive(Debug)]
pub struct Ref {
    pub points_at: String,
    pub name: String,
}

#[derive(Debug)]
#[allow(dead_code)]
pub enum OptionError {
    Unsupported,
    Error(String),
}

// Async trait for handling git remote protocol
pub trait GitRemoteHelper {
    async fn list(&mut self, for_push: bool) -> Vec<Ref>;
    async fn option(&mut self, name: String, value: String) -> Result<(), OptionError>;
    async fn fetch(&mut self, points_at: String, name: String) -> Result<(), String>;
    async fn push(&mut self, src: String, dst: String) -> Result<(), String>;
}

// Dummy implementation
pub struct DummyHelper;

impl GitRemoteHelper for DummyHelper {
    async fn list(&mut self, _for_push: bool) -> Vec<Ref> {
        vec![]
    }

    async fn option(&mut self, _name: String, _value: String) -> Result<(), OptionError> {
        Err(OptionError::Unsupported)
    }

    async fn fetch(&mut self, points_at: String, name: String) -> Result<(), String> {
        Err(format!(
            "Error: fetch command not yet implemented \"{points_at}\" \"{name}\""
        ))
    }

    async fn push(&mut self, src: String, dst: String) -> Result<(), String> {
        Err(format!(
            "Error: push command not yet implemented \"{src}\" \"{dst}\""
        ))
    }
}
