import os
from typing import Optional
from pathlib import Path

def get_image_path(file_path: str) -> str:
    """获取图片的绝对路径"""
    return os.path.abspath(file_path)

def format_user_mention(user_id: str, user_name: Optional[str] = None) -> str:
    """格式化用户@信息"""
    display_name = user_name if user_name else f"用户{user_id}"
    return f"@{display_name}" 


def get_luck_description(points: int) -> tuple[str, str]:
    """根据积分返回运气描述与emoji"""
    if points <= 10:
        return "非酋", "😭"
    if points <= 30:
        return "一般", "😐"
    if points <= 60:
        return "小欧", "😊"
    if points <= 90:
        return "大欧", "🎉"
    return "欧皇", "👑"


def format_sign_in_message(
    user_id: str,
    user_name: str,
    points: int,
    balance: int,
) -> str:
    """格式化签到成功消息"""
    luck_text, luck_emoji = get_luck_description(points)
    mention = format_user_mention(user_id, user_name)
    return (
        f"{mention} 📅 每日签到成功！\n"
        f"🎁 获得积分：{points}\n"
        f"{luck_emoji} 今日运气：{luck_text}\n"
        f"💰 当前积分：{balance}"
    )
