Documentation
use crate::extractors::{hentai_foundry::HentaiFoundry, youtube::Youtube};
use anyhow::Result;

use crate::{Extractor, Image, Video};

pub enum Info {
    Video(Video),
    Image(Image),
}

pub struct Client {
    http_client: reqwest::Client,
    extractors: Vec<Box<dyn Extractor>>,
}

impl Client {
    pub fn builder() -> ClientBuilder {
        ClientBuilder::new()
    }

    pub fn get_info(&self, url: &str) -> Result<Info> {
        todo!()
    }
}

pub struct ClientBuilder {
    http_client: reqwest::Client,
    extractors: Vec<Box<dyn Extractor>>,
}

impl ClientBuilder {
    pub fn new() -> ClientBuilder {
        let extractors: Vec<Box<dyn Extractor>> = vec![Box::new(Youtube), Box::new(HentaiFoundry)];
        let http_client = reqwest::Client::new();
        ClientBuilder {
            extractors,
            http_client,
        }
    }

    pub fn build(self) -> Result<Client> {
        Ok(Client {
            http_client: self.http_client,
            extractors: self.extractors,
        })
    }

    pub fn http_client(mut self, http_client: reqwest::Client) -> ClientBuilder {
        self.http_client = http_client;
        self
    }
}

impl Default for ClientBuilder {
    fn default() -> Self {
        Self::new()
    }
}