use super::tsv_util::{default_if_empty, from_sequence};
use serde::Deserialize;

#[derive(Deserialize, Debug, Default, Clone, Copy, PartialEq, Eq)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum AvatarUseType {
    #[default]
    None,
    AvatarFormal,
    AvatarAbandon,
    AvatarSyncTest,
}

#[derive(Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct AvatarData {
    pub body_type: String,
    pub icon_name: String,
    pub side_icon_name: String,
    pub quality_type: String,
    pub charge_efficiency: f32,
    pub initial_weapon: u32,
    pub weapon_type: String,
    pub image_name: String,
    pub skill_depot_id: u32,
    pub stamina_recover_speed: u32,
    #[serde(deserialize_with = "from_sequence")]
    pub cand_skill_depot_ids: Vec<u32>,
    #[serde(default)]
    pub avatar_identity_type: String,
    pub avatar_promote_id: u32,
    #[serde(deserialize_with = "from_sequence")]
    pub avatar_promote_reward_level_list: Vec<u32>,
    #[serde(rename = "featureTagGroupID")]
    pub feature_tag_group_id: u32,
    pub hp_base: f32,
    pub attack_base: f32,
    pub defense_base: f32,
    pub critical: f32,
    pub critical_hurt: f32,
    pub id: u32,
    #[serde(deserialize_with = "default_if_empty")]
    pub use_type: AvatarUseType,
    #[serde(default)]
    pub is_range_attack: bool,
}
