use crate::client::EuroMail;
use crate::errors::EuroMailError;
use crate::types::{InboundEmail, ListParams, PaginatedResponse};

impl EuroMail {
    pub async fn list_inbound_emails(
        &self,
        params: ListParams,
    ) -> Result<PaginatedResponse<InboundEmail>, EuroMailError> {
        let mut query: Vec<(&str, String)> = Vec::new();
        if let Some(page) = params.page {
            query.push(("page", page.to_string()));
        }
        if let Some(per_page) = params.per_page {
            query.push(("per_page", per_page.to_string()));
        }
        self.get_with_query("/v1/inbound", &query).await
    }

    pub async fn get_inbound_email(&self, id: &str) -> Result<InboundEmail, EuroMailError> {
        self.get(&format!("/v1/inbound/{id}")).await
    }

    pub async fn delete_inbound_email(&self, id: &str) -> Result<(), EuroMailError> {
        self.delete(&format!("/v1/inbound/{id}")).await
    }
}
