use super::{ComponentInspector, InspectorContext, impl_simple_inspector};
use nightshade::ecs::visibility::components::Visibility;
use nightshade::prelude::*;

fn visibility_ui(
    world: &mut World,
    entity: Entity,
    ui: &mut egui::Ui,
    _context: &mut InspectorContext,
) {
    if let Some(visibility) = world.core.get_visibility_mut(entity) {
        ui.horizontal(|ui| {
            ui.label("Visible:");
            ui.checkbox(&mut visibility.visible, "");
        });
    }
}

impl_simple_inspector!(
    VisibilityInspector,
    "Visibility",
    entity_has_visibility,
    set_visibility,
    remove_visibility,
    Visibility::default(),
    visibility_ui
);
