use std::path::Path;

use uri::Host;
use rustls::pki_types::{pem::PemObject, CertificateDer, PrivateKeyDer};

fn main() {
    println!("Hello, world!");
}

struct TlsStuff {
    public: Vec<CertificateDer<'static>>,
    private: PrivateKeyDer<'static>,
}

/// Load the full certificate chain (leaf first, then intermediates).
fn load_certs(path: impl AsRef<Path>) -> Result<Vec<CertificateDer<'static>>, String> {
    let certs = CertificateDer::pem_file_iter(path).unwrap()
        .collect::<Result<Vec<_>, _>>().unwrap();
    Ok(certs)
}

/// Load the first private key found, regardless of encoding
/// (PKCS#8, PKCS#1/RSA, or SEC1/EC all work).
fn load_key(path: impl AsRef<Path>) -> Result<PrivateKeyDer<'static>, String> {
    Ok(PrivateKeyDer::from_pem_file(path).unwrap())
}

//Given a file path and a host, respond to any request under that host with the contents of that file.
fn serve_file(path: &Path, host: Host, tls: Option<TlsStuff>) -> Result<(),String> {
    Ok(())
}

//Given some html bytes (unverified) and a host, respond to any request under that host with those bytes.
fn serve_html_bytes(bytes: &[u8], host: Host, tls: Option<TlsStuff>) -> Result<(), String> {
    Ok(())
}