use std::fmt::Debug;
use async_trait::async_trait;
use super::super::domain::Project;
use super::super::domain::ProjectId;
#[cfg_attr(test, mockall::automock)]
#[async_trait]
pub trait ProjectRepository: Debug + Send + Sync + 'static {
async fn read(&self, project_id: &ProjectId) -> Result<Project, ProjectRepositoryError>;
async fn list(&self) -> Result<Vec<Project>, ProjectRepositoryError>;
}
#[derive(Debug, Clone, thiserror::Error)]
pub enum ProjectRepositoryError {
#[error("the `Project` ({id}) could not be found")]
ResourceNotFound { id: ProjectId },
#[error("unable to parse the `Project` ({id}) ")]
Parsing { id: ProjectId },
#[error("unable to interact with the datastore backend: {message}")]
Infrastucture { message: String },
}