import handlers
import profiles
import locales
from profiles.ProfileManager import get_full_profile_by_tg_id
from profiles.ProfileManager import update
from keyboards.guide_kb import guide_keyboard
import profiles.ProfileStep as ProfileStep
from bot import bot
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
from bot import url_all, url_ru

def guide(call):
    p = get_full_profile_by_tg_id(call.from_user.id)

    p.step = ProfileStep.GUIDE
    update(p)

    text = (
        f"{locales.get(p.language, 'guide_title')}\n\n"
        f"{locales.get(p.language, 'guide_subtitle')}"
    )

    url = url_all
    if(p.language == 'ru'):
        url = url_ru

    url += '&sub_id1='+str(p.tg_id)

    reply_markup = guide_keyboard(p, url)

    #button_back = InlineKeyboardButton(text=f"{locales.get(p.language, 'btn_lang_back')}", callback_data='lang_back')
    #reply_markup.add(button_back)


    handlers.ui.render(
        p,
        call.message.chat.id,
        text,
        reply_markup=reply_markup
    )



