use std::ops::Add;
use serde::Serialize;

pub mod walker;
pub mod spawner;
pub mod sticker;
pub mod model;
pub mod spaces;

pub trait Position: Add<Output=Self> + Serialize + Clone {
    // const DIM: usize;
    type Cartesian;

    fn zero() -> Self;
    fn abs(&self) -> f32;
    fn from_cartesian(cartesian: Self::Cartesian) -> Self;
    fn to_cartesian(&self) -> Self::Cartesian;
}

pub trait GriddedPosition: Position {
    const NEIGHBOURS: u32;

    fn neighbour(&self, neighbour_index: u32) -> Self;
    fn linear_index(&self, grid_size: u32) -> usize;
}

pub trait Storage<P: Position> {
    fn is_occupied(&self, position: &P) -> bool;
    fn deposit(&mut self, position: &P);
}
