use std::collections::HashMap;

use proto::EquippedBuddyData;

use crate::logic::{BaseProperty, BuddyTeamType};

pub struct EquippedBuddyDataItem {
    pub buddy_id: u32,
    pub buddy_team: BuddyTeamType,
    pub override_property_map: HashMap<BaseProperty, i32>,
}

impl EquippedBuddyDataItem {
    pub fn to_client(&self) -> EquippedBuddyData {
        EquippedBuddyData {
            buddy_id: self.buddy_id,
            r#type: self.buddy_team.to_protocol().into(),
            mp_property_override_map: self
                .override_property_map
                .iter()
                .map(|(prop, value)| (*prop as u32, *value))
                .collect(),
        }
    }
}
