use bd2::prost::Message;
use bd2::proto::proto_net::{
    MonsterHuntUserDbInfo, MonsterHuntUserInfoRequest, MonsterHuntUserInfoResponse, Notify,
};
use common::packet_code::PacketCodeType;
use crypto::network::GameResponse;
use sqlx::SqlitePool;
use tracing::info;

pub async fn handle(
    _pool: &SqlitePool,
    _uid: i64,
    req: MonsterHuntUserInfoRequest,
) -> GameResponse {
    info!("Handling MonsterHuntUserInfoRequest: {:?}", req);

    let monster_hunt_user_info = MonsterHuntUserDbInfo {
        season: Some(51),
        monster_hunt_id: Some(50),
        level: Some(1),
        start_hp: Some(33000),
        highest_first_turn_damage: Some(0),
        highest_hp: Some(33000),
        highest_hp_date: Some(1761192175000),
        current_level_highest_damage: Some(0),
        daily_highest_damage: Some(0),
        season_reward: Some(false),
        daily_reward_level: Some(0),
        daily_reward_date: Some(0),
    };

    let response = MonsterHuntUserInfoResponse {
        monster_hunt_user_info: Some(monster_hunt_user_info),
        rank: Some(0),
        rank_top_percent: Some(0.0),
    };

    let resp_bytes = response.encode_to_vec();

    let notify = Notify {
        achievement_update_info: vec![],
        mission_update_info: vec![],
        event_mission_update_info: vec![],
        active_login_event: vec![1, 2, 628, 629],
        active_contents_info: vec![],
        ll_type: Some("".to_string()),
        is_purchasing_disabled: Some(false),
        maintenance_start_date: Some(1688646600000),
        notice_last_seq: Some(8909),
        ..Default::default()
    };

    let (route, code) = PacketCodeType::MonsterHuntUserInfo.info();
    GameResponse::success(route, &resp_bytes, code).with_notify(&notify)
}
