use rltk::RGB;
use specs::prelude::*;

#[derive(Component)]
pub struct Position {
    pub x: i32,
    pub y: i32,
}

#[derive(Component)]
pub struct Renderable {
    pub glyph: u8,
    pub fg: RGB,
    pub bg: RGB,
}

#[derive(Component, Debug)]
pub struct Player;

#[derive(Component)]
pub struct Viewshed {
    pub visible_tiles: Vec<rltk::Point>,
    pub range: i32,
    pub dirty: bool,
}

#[derive(Component, Debug)]
pub struct Monster;

#[derive(Component, Debug)]
pub struct Name {
    pub name: String,
}

#[derive(Component, Debug)]
pub struct BlocksTile;

#[derive(Component, Debug)]
pub struct CombatStats {
    pub max_hp: i32,
    pub hp: i32,
    pub defense: i32,
    pub power: i32,
}

#[derive(Component, Debug)]
pub struct WantsToMelee {
    pub target: Entity,
}

#[derive(Component, Debug)]
pub struct SufferDamage {
    pub amount: i32,
}

#[derive(Component, Copy, Clone, Debug)]
pub struct MoveEvent {
    pub destination: usize,
    pub tgt_x: i32,
    pub tgt_y: i32,
}

/// This type represents all the "low-level" actions we have available
/// to us, corresponding directly to the set of actions we have bound
/// on the keys
#[derive(Component)]
pub enum InputEvent {
    // attempt to move the player some amount in the given direction
    // (delta_x and delta_y should be -1, 0, or 1)
    PlayerMovement { delta_x: i32, delta_y: i32 },
}

#[derive(Component, Copy, Clone, Debug)]
pub struct Seek {
    pub tgt_x: i32,
    pub tgt_y: i32,
}
