use std::collections::HashMap;

use crate::logic::BuddyTeamType;

use super::unit::{AvatarUnit, AvatarUnitID, BuddyUnit, BuddyUnitID};

pub struct TeamDataItem {
    pub avatar_member_list: Vec<AvatarUnit>,
    pub equipped_buddy_list: Vec<BuddyUnit>,
}

pub struct BuddyParam(pub BuddyUnitID, pub BuddyTeamType);

impl TeamDataItem {
    pub fn new(avatars: &[AvatarUnitID], buddy_params: &[BuddyParam]) -> Self {
        Self {
            avatar_member_list: avatars
                .iter()
                .map(|id| AvatarUnit {
                    avatar_id: *id,
                    mp_property_override: HashMap::new(),
                })
                .collect(),
            equipped_buddy_list: buddy_params
                .iter()
                .map(|param| BuddyUnit {
                    buddy_id: param.0,
                    buddy_team: param.1,
                    override_property_map: HashMap::new(),
                })
                .collect(),
        }
    }
}
