//! Removes runtime-only components generated by hydration before save or re-hydrate.

use avian3d::prelude::*;
use bevy::prelude::*;

/// Strips hydrated components via [`EntityWorldMut`] (e.g. before scene save).
pub fn strip_hydrated_entity(entity: &mut EntityWorldMut<'_>) {
    entity
        .remove::<Mesh3d>()
        .remove::<MeshMaterial3d<StandardMaterial>>()
        .remove::<PointLight>()
        .remove::<SpotLight>()
        .remove::<DirectionalLight>()
        .remove::<WorldAssetRoot>()
        .remove::<DynamicWorldRoot>()
        .remove::<RigidBody>()
        .remove::<Collider>();
}

/// Strips all components hydration may insert so authoring data can be re-applied cleanly.
pub fn strip_hydrated(entity_commands: &mut EntityCommands<'_>) {
    entity_commands
        .remove::<Mesh3d>()
        .remove::<MeshMaterial3d<StandardMaterial>>()
        .remove::<PointLight>()
        .remove::<SpotLight>()
        .remove::<DirectionalLight>()
        .remove::<WorldAssetRoot>()
        .remove::<DynamicWorldRoot>()
        .remove::<RigidBody>()
        .remove::<Collider>();
}
