package cz.moneta.test.dsl.hypos.pages.contract.realty;

import cz.moneta.test.dsl.hypos.components.Menu;
import cz.moneta.test.dsl.hypos.pages.HyposPageFlow;
import cz.moneta.test.harness.support.web.*;

public interface CreateNewUnitPage extends HyposPageFlow<CreateNewUnitPage>, Menu {
    String PAGE_TITLE = "//h1[text()='Nový celek']";
    String GUARANTEE_CODE_SELECT = "//select[@name='codeId']";
    String FUTURE_REALTY_TYPE_SELECT = "//select[@name='finalRealtyType']";
    String PLEDGE_TYPE_SELECT = "//select[@name='typeId']";
    String PLEDGE_CODE_SELECT = "//select[@name = 'codeId']";
    String USE_THIS_UNIT_CHECKBOX = "//input[@name='isNatural']";
    String SAVE_BUTTON = "//th//input[@value='Uložit']";
    String SAVE_PLEDGE_BUTTON = "//table//a[text()='Uložit']";
    String PLEDGE_LOADER = "//table//img[@src='/img/common/loadingAnimationSmall.gif']";

    @Select(GUARANTEE_CODE_SELECT)
    CreateNewUnitPage selectCode(String guaranteeCode);

    @Select(FUTURE_REALTY_TYPE_SELECT)
    CreateNewUnitPage selectRealtyType(String realtyType);

    @Select(PLEDGE_TYPE_SELECT)
    CreateNewUnitPage selectPledgeType(String pledgeType);

    @Select(PLEDGE_CODE_SELECT)
    CreateNewUnitPage selectPledgeCode(String pledgeCode);

    @Click(USE_THIS_UNIT_CHECKBOX)
    CreateNewUnitPage clickUseThisUnitCheckbox();

    @Click(SAVE_BUTTON)
    UnitDetailPage clickSaveButton();

    @Click(value = SAVE_PLEDGE_BUTTON, andWait = @Wait(value = PLEDGE_LOADER, until = Until.GONE))
    CreateNewUnitPage clickSavePledgeButton();
}
