//! Provides APIs for building an application with pkecs.

pub mod plugin;

use pkecs_core::{event::EventHandler, schedule::System};
use plugin::Plugin;

/// An application which uses pkecs as it's framework.
pub trait Application {
    /// Adds a system to [`self`].
    fn add_system<TSchedule, TSystem>(&mut self, schedule: TSchedule, system: TSystem) -> &mut Self
        where
            TSchedule: 'static,
            TSystem: System + 'static;

    fn handle_event<TEvent, TEventHandler>(&mut self, handler: TEventHandler) -> &mut Self
        where
            TEvent: 'static,
            TEventHandler: EventHandler<TEvent> + 'static;

    /// Configures [`self`] with a [`Plugin`].
    fn add_plugin<TPlugin>(&mut self) -> &mut Self
        where
            TPlugin: Plugin;
}
