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.BankersOnBranchPage.PAGE_TITLE;

@Wait(PAGE_TITLE)
public interface BankersOnBranchPage extends FortePageFlow<BankersOnBranchPage>, AppointmentsMenu {
    String PAGE_TITLE = CONTENT_DIV + "//h3[contains(text(), 'Správa bankéřů na pobočce')]";
    String CHANGE_BUTTON = CONTENT_DIV + "//a[@href='/appointments/branchbankers/?do=capacityForm-show']";
    String CAPACITY_FORM = "//form[@id='frm-capacityForm-capacityForm']";
    String CAPACITY = CAPACITY_FORM + "//input[@id='frmcapacityForm-capacity']";
    String CHANGE_CAPACITY_BUTTON = CAPACITY_FORM + "//input[@name='add']";
    String BRANCH_CAPACITY_LABEL = "//div[@class='capacity']";

    @Click(value = CHANGE_BUTTON, andWait = @Wait(CAPACITY))
    BankersOnBranchPage clickChangeCapacity();

    @TypeInto(value = CAPACITY, clear = true)
    BankersOnBranchPage fillCapacity(int capacityCount);

    @Click(value = CHANGE_CAPACITY_BUTTON, andWait = @Wait(value = SPINNER, until = Until.GONE, by = Lookup.ID))
    BankersOnBranchPage clickSetCapacity();

    @CheckElementContent(BRANCH_CAPACITY_LABEL)
    BankersOnBranchPage checkBranchCapacity(int capacity);

}