/*
    Hurry Curry! - a game about cooking
    Copyright 2024 metamuffin
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, version 3 of the License only.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.
    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see .
*/
use hurrycurry_protocol::glam::Vec2;
use std::{collections::HashMap, hash::Hash};
// TODO stub implementation. please implement
pub struct SpatialIndex {
    entries: HashMap,
}
impl SpatialIndex {
    pub fn update_entry(&mut self, id: T, position: Vec2) {
        self.entries.insert(id, position);
    }
    pub fn remove_entry(&mut self, id: T) {
        self.entries.remove(&id);
    }
    pub fn all(&self, mut cb: impl FnMut(T, Vec2)) {
        for (&e, &pos) in &self.entries {
            cb(e, pos)
        }
    }
    pub fn query(&self, _position: Vec2, _radius: f32, cb: impl FnMut(T, Vec2)) {
        self.all(cb)
    }
}
impl Default for SpatialIndex {
    fn default() -> Self {
        Self {
            entries: Default::default(),
        }
    }
}