use super::Entity;

#[derive(Debug, Clone)]
pub enum SubentityRef<E: Entity> {
    NotLoaded,
    Loaded(E),
}

impl<E: Entity> SubentityRef<E> {
    pub fn get(&self) -> &E {
        return match &self {
            SubentityRef::NotLoaded => panic!("Entity list has not been loaded"),
            SubentityRef::Loaded(entity_vec) => entity_vec,
        };
    }

    pub fn into_entity(self) -> E {
        return match self {
            SubentityRef::NotLoaded => panic!("Entity list has not been loaded"),
            SubentityRef::Loaded(entity_vec) => entity_vec,
        };
    }
}
