use crate::proxies::archivebate::ArchivebateProxy;
use crate::proxies::clapdat::ClapdatProxy;
use crate::proxies::doodstream::DoodstreamProxy;
use crate::proxies::heavyfetish::HeavyfetishProxy;
use crate::proxies::hqporner::HqpornerProxy;
use crate::proxies::pornhd3x::Pornhd3xProxy;
use crate::proxies::supjav::SupjavProxy;
use crate::proxies::tube8::Tube8Proxy;
use ntex::web;

use crate::proxies::pimpbunny::PimpbunnyProxy;
use crate::proxies::porndish::PorndishProxy;
use crate::proxies::spankbang::SpankbangProxy;
use crate::proxies::vjav::VjavProxy;
use crate::{proxies::sxyprn::SxyprnProxy, util::requester::Requester};
use crate::proxies::vidara::VidaraProxy;
use crate::proxies::lulustream::LulustreamProxy;
use crate::proxies::thaiporntv::ThaipornTvProxy;

pub mod allpornstream;
pub mod melonstube;
pub mod animeidhentai;
pub mod archivebate;
pub mod clapdat;
pub mod doodstream;
pub mod fikfapthumb;
pub mod hanimecdn;
pub mod hanimethumb;
pub mod heavyfetish;
pub mod hentaitv;
pub mod hqporner;
pub mod hqpornerthumb;
pub mod javtiful;
pub mod lulustream;
pub mod noodlemagazine;
pub mod pimpbunny;
pub mod porndish;
pub mod porndishthumb;
pub mod pornhd3x;
pub mod pornhubthumb;
pub mod shooshtime;
pub mod spankbang;
pub mod supjav;
pub mod sxyprn;
pub mod thaiporntv;
pub mod hotbunnythumb;
pub mod jable;
pub mod tube8;
pub mod thepornbunny;
pub mod vidara;
pub mod vjav;

#[derive(Debug, Clone)]
pub enum AnyProxy {
    Archivebate(ArchivebateProxy),
    Doodstream(DoodstreamProxy),
    Sxyprn(SxyprnProxy),
    Javtiful(javtiful::JavtifulProxy),
    Lulustream(LulustreamProxy),
    Pornhd3x(Pornhd3xProxy),
    Pimpbunny(PimpbunnyProxy),
    Porndish(PorndishProxy),
    Spankbang(SpankbangProxy),
    Hqporner(HqpornerProxy),
    Heavyfetish(HeavyfetishProxy),
    Vjav(VjavProxy),
    Vidara(VidaraProxy),
    Clapdat(ClapdatProxy),
    ThaipornTv(ThaipornTvProxy),
    Tube8(Tube8Proxy),
    Supjav(SupjavProxy),
}

pub trait Proxy {
    async fn get_video_url(&self, url: String, requester: web::types::State<Requester>) -> String;
}

impl Proxy for AnyProxy {
    async fn get_video_url(&self, url: String, requester: web::types::State<Requester>) -> String {
        match self {
            AnyProxy::Archivebate(p) => p.get_video_url(url, requester).await,
            AnyProxy::Doodstream(p) => p.get_video_url(url, requester).await,
            AnyProxy::Sxyprn(p) => p.get_video_url(url, requester).await,
            AnyProxy::Javtiful(p) => p.get_video_url(url, requester).await,
            AnyProxy::Lulustream(p) => p.get_video_url(url, requester).await,
            AnyProxy::Pornhd3x(p) => p.get_video_url(url, requester).await,
            AnyProxy::Pimpbunny(p) => p.get_video_url(url, requester).await,
            AnyProxy::Porndish(p) => p.get_video_url(url, requester).await,
            AnyProxy::Spankbang(p) => p.get_video_url(url, requester).await,
            AnyProxy::Hqporner(p) => p.get_video_url(url, requester).await,
            AnyProxy::Heavyfetish(p) => p.get_video_url(url, requester).await,
            AnyProxy::Vjav(p) => p.get_video_url(url, requester).await,
            AnyProxy::Vidara(p) => p.get_video_url(url, requester).await,
            AnyProxy::Clapdat(p) => p.get_video_url(url, requester).await,
            AnyProxy::ThaipornTv(p) => p.get_video_url(url, requester).await,
            AnyProxy::Tube8(p) => p.get_video_url(url, requester).await,
            AnyProxy::Supjav(p) => p.get_video_url(url, requester).await,
        }
    }
}
