use std::collections::HashMap;

use crate::logic::BaseProperty;
use proto::AvatarUnitInfo;

pub struct AvatarUnit {
    pub avatar_id: u32,
    pub mp_property_override: HashMap<BaseProperty, i32>,
}

impl AvatarUnit {
    pub fn to_client(&self) -> AvatarUnitInfo {
        AvatarUnitInfo {
            avatar_id: self.avatar_id,
            mp_property_override_map: self
                .mp_property_override
                .iter()
                .map(|(prop, value)| (*prop as u32, *value))
                .collect(),
            ..Default::default()
        }
    }
}
