use rand::RngCore;
use std::ops::{Deref, DerefMut};
use crate::{
agent::Agent,
space::Space,
types::{AgentId, Time},
};
pub trait Model {
type Agent: Agent;
type Space: Space;
type Properties;
type Rng: RngCore;
type AgentRef<'a>: Deref<Target = Self::Agent>
where
Self: 'a;
type AgentRefMut<'a>: DerefMut<Target = Self::Agent>
where
Self: 'a;
fn time(&self) -> Time;
fn rng_mut(&self) -> impl DerefMut<Target = Self::Rng> + '_;
fn space(&self) -> &Self::Space;
fn properties(&self) -> &Self::Properties;
fn properties_mut(&mut self) -> &mut Self::Properties;
fn agent(&self, id: AgentId) -> Option<Self::AgentRef<'_>>;
fn agent_mut(&self, id: AgentId) -> Option<Self::AgentRefMut<'_>>;
fn has_id(&self, id: AgentId) -> bool {
self.agent(id).is_some()
}
}