use async_trait::async_trait;
use thiserror::Error;
#[derive(Debug, Clone)]
pub struct OriginCertificate {
pub certificate: String,
pub private_key: String,
pub expires_on: String,
}
#[derive(Debug, Error)]
pub enum DnsError {
#[error("HTTP request failed: {0}")]
Request(String),
#[error("API error: {0}")]
Api(String),
}
#[async_trait]
#[allow(dead_code)]
pub trait DnsProvider: Send + Sync {
async fn create_record(&self, subdomain: &str, proxied: bool) -> Result<String, DnsError>;
async fn delete_record(&self, record_id: &str) -> Result<(), DnsError>;
async fn create_origin_certificate(
&self,
validity_days: u32,
) -> Result<Option<OriginCertificate>, DnsError>;
async fn cleanup_old_origin_certificates(&self) -> Result<u32, DnsError>;
}