from mower.utils.scene import Scene
from mower.utils.solver import BaseSolver

from .utils import edge


@edge(Scene.UNKNOWN_ROGUE, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_SELECT, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_AWARD_BEFORE_EXPLORE, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_TEAM_SELECT, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_INIT_RECRUIT, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_RECRUIT_SELECT, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_RECRUIT_AGENT_SELECT, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_NODE_BEFORE_GO, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_NODE_LOADING, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_NODE_OPTION_SELECT, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_SHOP, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_INVESTMENT, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_INVESTMENT_PORTAL, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_MAIN, Scene.ROGUE_INDEX)
def rogue_back_to_index(solver: BaseSolver):
    solver.ctap("rogue/back", 3)


@edge(Scene.ROGUE_NODE_LOADING, Scene.ROGUE_MAIN)
@edge(Scene.ROGUE_LAYER_LOADING, Scene.ROGUE_MAIN)
@edge(Scene.ROGUE_NODE_BEFORE_GO, Scene.ROGUE_MAIN)
def to_rogue_main(solver: BaseSolver):
    solver.tap((20, 860))


@edge(Scene.ROGUE_MONTHLY_COMMISION, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_LEVEL_UP, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_SETTLEMENT, Scene.ROGUE_INDEX)
def settlement_to_index(solver: BaseSolver):
    solver.ctap((960, 950), 3)


@edge(Scene.ROGUE_ABANDON, Scene.ROGUE_INDEX)
@edge(Scene.ROGUE_REFRESH_SHOP, Scene.ROGUE_SHOP)
@edge(Scene.ROGUE_ABANDON_RECRUIT, Scene.ROGUE_INIT_RECRUIT)
def double_confirm_back(solver: BaseSolver):
    solver.ctap("double_confirm/main", 2, x_rate=1)


@edge(Scene.ROGUE_CONFUSION_WARNING, Scene.ROGUE_MAIN)
@edge(Scene.ROGUE_REFRESH_CONFIRM, Scene.ROGUE_MAIN)
@edge(Scene.ROGUE_DOUBLE_CONFIRM, Scene.ROGUE_MAIN)
def rougue_double_confirm(solver: BaseSolver):
    solver.ctap("rogue/double_confirm/main", 3, x_rate=0)


@edge(Scene.ROGUE_INDEX, Scene.ROGUE_THEME_SELECT)
@edge(Scene.ROGUE_THEME_SELECT, Scene.TERMINAL_REGULAR)
@edge(Scene.ROGUE_RECRUIT_AGENT_SELECT, Scene.ROGUE_INIT_RECRUIT)
@edge(Scene.ROGUE_SARKAZ_LIGHTEN_LOAD, Scene.ROGUE_SARKAZ_LOAD)
@edge(Scene.ROGUE_SARKAZ_LOAD, Scene.ROGUE_MAIN)
def rogue_back(solver: BaseSolver):
    solver.cback(3)
