package cz.moneta.test.dsl.fortelight.pages.intermediary;

import cz.moneta.test.dsl.fortelight.ForteLightPageFlow;
import cz.moneta.test.harness.support.web.CheckElementContent;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.fortelight.pages.intermediary.ImportdealercheckPage.PAGE_TITLE;

@Wait(PAGE_TITLE)
public interface ImportdealercheckPage extends ForteLightPageFlow<ImportdealercheckPage> {
    String CONTENT_DIV = "//div[@class='content_data']";
    String PAGE_TITLE = CONTENT_DIV + "//h3[starts-with(text(), 'Kontrola nových prodejců')]";
    String GRID = CONTENT_DIV + "//div[@id='snippet--results']";
    String GRID_TITLE = GRID + "//h4[text()='Nalezené pobočky']";
    String GRID_RESULT = GRID + "//a[starts-with(text(), 'Brno')]";

//    String REMOVE_LINK = "//form[@id='frm-grid-form']//tr[contains(*/td/span/text(),'Bachar Petr,  Ing. PhDr')]//a[@title='Odstranit prodejce']//span[@class='icon-container']";
//    String REMOVE_LINK = "//form[@id='frm-grid-form']//tr/td/span[normalize-space(text())='Bachar Petr,  Ing. PhDr']//a[@title='Odstranit prodejce']//span[@class='icon-container']";
    String REMOVE_LINK = "//form[@id='frm-grid-form']//tr[contains(., 'Bachar')]//td//a[@title='Odstranit prodejce']//span[@class='icon-container']";
//    String REMOVE_LINK = "//form[@id='frm-grid-form']//tr//td//a[@title='Odstranit prodejce']//span[@class='icon-container']";
    String YES_BUTTON = "//div[@id='snippet-confirmForm-']//button[@name='yes']";

    @CheckElementContent(PAGE_TITLE)
    ImportdealercheckPage checkPageTitle(String pageTitle);

    @CheckElementContent(GRID_TITLE)
    ImportdealercheckPage checkGrid(String gridTitle);

    @CheckElementContent(GRID_RESULT)
    ImportdealercheckPage checkResult(String gridResult);

    @Click(REMOVE_LINK)
    ImportdealercheckPage clickRemoveDealer();

    @Click(YES_BUTTON)
    ImportdealercheckPage clickYes();
}