use crate::payments::{Error, PaymentProcessor};
use async_trait::async_trait;
use pbbson::Model;

const ERR_MSG: &str = "Payment processor has not been configured";

pub struct ServiceUnavailablePaymentProcessor {}

impl ServiceUnavailablePaymentProcessor {
    pub fn new(_app_name: &str) -> Self {
        Self {}
    }
}

#[async_trait]
impl<B: Clone + Send + Sync + ToString + 'static> PaymentProcessor<B> for ServiceUnavailablePaymentProcessor {
    async fn create_checkout_session(
        &self,
        _account: Model,
        _plan: Model,
        _plan_metadata_field: &str,
        _client_reference_id: Option<String>,
        _success_url: Option<String>,
        _cancel_url: Option<String>,
    ) -> Result<Model, Error> {
        Err(Error::unavailable(ERR_MSG))
    }

    async fn sync_account(&self, _account: Model, _accounts_bucket: B) -> Result<Model, Error> {
        Err(Error::unavailable(ERR_MSG))
    }

    async fn sync_plan(
        &self,
        _plan: Model,
        _plan_metadata_field: &str,
        _services_bucket: B,
        _plans_bucket: B,
    ) -> Result<Model, Error> {
        Err(Error::unavailable(ERR_MSG))
    }
}
