use std::{ops::Deref, sync::Arc};

use lunar_lib::database::{DatabaseEntry, TransactionError};

pub type Resolved<T> = <T as Resolveable>::Resolved;

pub trait Resolveable: DatabaseEntry {
    type Resolved: Deref<Target = Self>;

    fn resolve(item: Arc<Self>, db: &Self::Db) -> Result<Self::Resolved, TransactionError>;
}
