use crate::repository::api::prelude::*;

pub async fn get_referral_info(tg_id: i64) -> Result<ReferralInfo> {
    let user_id = get_test_user_id(tg_id);
    rust_shared::repository::api::get_referral_info(user_id).await
}

pub async fn get_profile(tg_id: i64) -> Result<Profile> {
    let user_id = get_test_user_id(tg_id);
    rust_shared::repository::api::get_profile_by_user_id(user_id).await
}

pub async fn reset_password(tg_id: i64, pool: PoolType) -> Result<String> {
    let user_id = get_test_user_id(tg_id);
    rust_shared::repository::api::reset_password(user_id, pool).await
}

pub async fn is_password_exists(tg_id: i64) -> Result<bool> {
    let user_id = get_test_user_id(tg_id);
    rust_shared::repository::api::is_password_exists(user_id).await
}

pub async fn change_account_password(tg_id: i64, old_password: Option<String>, new_password: String) -> Result<()> {
    let user_id = get_test_user_id(tg_id);
    rust_shared::repository::api::change_account_password(user_id, old_password, new_password).await
}

pub async fn create_referral_withdrawal_request(
    tg_id: i64,
    amount: f64,
    comment: String,
) -> Result<WithdrawalResponse> {
    let user_id = get_test_user_id(tg_id);
    rust_shared::repository::api::create_referral_withdrawal_request(user_id, amount, comment).await
}
