use std::future::Future;
use std::pin::Pin;

use clap::{ArgMatches, Command};
use tail_fin_common::TailFinError;

use crate::session::Ctx;

#[allow(dead_code)]
/// Trait for CLI adapter registration.
///
/// Each site adapter implements this to provide its name, description,
/// clap subcommands, and dispatch logic. The main CLI collects all
/// registered adapters and builds the command tree dynamically.
pub trait CliAdapter: Send + Sync {
    /// The CLI subcommand name (e.g. "twitter", "reddit").
    fn name(&self) -> &'static str;

    /// Short description shown in --help.
    fn about(&self) -> &'static str;

    /// Build the clap Command with all subcommands for this adapter.
    fn command(&self) -> Command;

    /// Dispatch a parsed subcommand to the adapter's run function.
    fn dispatch<'a>(
        &'a self,
        matches: &'a ArgMatches,
        ctx: &'a Ctx,
    ) -> Pin<Box<dyn Future<Output = Result<(), TailFinError>> + Send + 'a>>;
}
