package cz.moneta.test.dsl.hypos.pages.cadaster;

import cz.moneta.test.dsl.hypos.pages.HyposPageFlow;
import cz.moneta.test.dsl.hypos.pages.contract.realty.UnitDetailPage;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.support.web.CheckElementPresent;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.hypos.pages.cadaster.CadasterRedocDetailPage.CADASTER_REQUEST;

@Wait(CADASTER_REQUEST)
public interface CadasterRedocDetailPage extends HyposPageFlow<CadasterRedocDetailPage>, StoreAccessor {
    String CADASTER_REQUEST = "//table[@id='cadaster-requests']/tbody/tr";

    String REALTY_DETAIL = "//*[contains(text(),'%s')]//following::a[contains(@href,'realty.overview')]";
    String FLAT_UNIT_DETAIL = "//table[@id='flat-listing']" + REALTY_DETAIL;
    String BUILDING_DETAIL = "//table[@id='building-listing']" + REALTY_DETAIL;
    String LAND_DETAIL = "//table[@id='lot-listing']" + REALTY_DETAIL;

    @CheckElementPresent(CADASTER_REQUEST)
    CadasterRedocDetailPage checkCadasterRequest();

    @Click(value = FLAT_UNIT_DETAIL, isStringDynamicXpath = true)
    UnitDetailPage clickFlatUnitDetail(String flatNumber);

    @Click(value = BUILDING_DETAIL, isStringDynamicXpath = true)
    UnitDetailPage clickBuildingDetail(String buildingNumber);

    @Click(value = LAND_DETAIL, isStringDynamicXpath = true)
    UnitDetailPage clickLandDetail(String buildingNumber);
}