package cz.moneta.test.dsl.forte.pages.appointments;

import cz.moneta.test.dsl.forte.FortePageFlow;
import cz.moneta.test.dsl.forte.components.AppointmentsMenu;
import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.forte.pages.appointments.SelectOMPage.PAGE_TITLE;

@Wait(PAGE_TITLE)
public interface SelectOMPage extends FortePageFlow<SelectOMPage>, AppointmentsMenu {
    String PAGE_TITLE = CONTENT_DIV + "//h3[text()='Výběr OM']";
    String OM_NAME = "//input[@class='typeSearch text ui-autocomplete-input']";
    String FIRST_SEARCHED_OM = "//div[@class='ui-menu-item-wrapper']";
    String FORM_DIALOG = "//div[@id='snippet-newBranchForm-']";
    String ROLE_MENU = FORM_DIALOG + "//select[@id='frmnewBranchForm-role']";
    String ADD_OM_BUTTON = FORM_DIALOG + "//input[@type='submit']";
    String SET_ACTIVE_BRANCH_BUTTON = CONTENT_DIV + "//input[@type='submit']";

    @TypeInto(value = OM_NAME)
    SelectOMPage fillBranchName(String branchName);

    @Click(FIRST_SEARCHED_OM)
    SelectOMPage clickFirstSearchedOm();

    @Select(ROLE_MENU)
    SelectOMPage clickRoleMenu(String roleName);

    @Click(value = ADD_OM_BUTTON, andWait = @Wait(value = SPINNER, until = Until.GONE, by = Lookup.ID))
    SelectOMPage clickSubmit();

    @Click(SET_ACTIVE_BRANCH_BUTTON)
    BankersOnBranchPage clickSetActiveBranch();

}