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

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

import static cz.moneta.test.dsl.hypos.pages.contract.approvalchecklist.ChecklistImportDocModalPage.PAGE_TITLE;

@Wait(PAGE_TITLE)
public interface ChecklistImportDocModalPage extends HyposPageFlow<ChecklistImportDocModalPage>, Menu {
    String MODAL_XPATH = "//div[@id='simplemodal-container']";
    String PAGE_TITLE = MODAL_XPATH + "//h2[text()='Import souboru k požadovanému dokumentu']";
    String CHOOSE_FILE = MODAL_XPATH + "//input[@type='file']";
    String SAVE_BUTTON = MODAL_XPATH + "//button[text()='Uložit']";
    String VALIDITY_DATE_INPUT = MODAL_XPATH + "//input[@name='validityDate']";

    @FileUpload(CHOOSE_FILE)
    ChecklistImportDocModalPage uploadFileChecklist(String filePath);

    @TypeInto(value = VALIDITY_DATE_INPUT, clear = true)
    ChecklistImportDocModalPage fillValidityDate(String validityDate);

    @KeyPress(value = Key.TAB, andWait = @Wait(value = LOADER, until = Until.GONE))
    ChecklistImportDocModalPage checkValidityDate();

    @Click(SAVE_BUTTON)
    ApprovalChecklistPage saveFileChecklist();
}