use bevy::prelude::*;
use clap::Parser;

pub fn plugin(app: &mut App) {
    let config = ServerConfig::parse();

    app.insert_resource(config);
}

/// The server for HEDZ Reloaded
#[derive(Resource, Parser, Debug)]
#[command(version, about, long_about = None)]
pub struct ServerConfig {
    #[arg(long, default_value_t = f32::INFINITY)]
    /// How long to wait for a client to connect before closing, in seconds
    pub timeout: f32,
    #[arg(long, default_value_t = false)]
    /// Whether to close when a client disconnects
    pub close_on_client_disconnect: bool,
}
