use super::Options;
use crate::storage::{Error, object_store::ObjectStore};
use async_trait::async_trait;
use std::path::Path;
use tempfile::NamedTempFile;

const ERR_MSG: &str = "Object storage has not been configured";

pub struct ServiceUnavailableObjectStore {}

impl ServiceUnavailableObjectStore {
    pub fn new(_options: Options) -> Self {
        Self {}
    }
}

#[async_trait]
impl ObjectStore for ServiceUnavailableObjectStore {
    async fn del(&self, _key: &str) -> Result<(), Error> {
        Err(Error::unavailable(ERR_MSG))
    }

    async fn get(&self, _key: &str) -> Result<NamedTempFile, Error> {
        Err(Error::unavailable(ERR_MSG))
    }

    async fn put(&self, _key: &str, _path: &Path) -> Result<(), Error> {
        Err(Error::unavailable(ERR_MSG))
    }
}
