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

import cz.moneta.test.dsl.hypos.pages.HyposPageFlow;
import cz.moneta.test.dsl.hypos.pages.contract.ContractHistoryPage;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.TypeInto;
import cz.moneta.test.harness.support.web.Until;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.hypos.pages.contract.documents.DocumentSignPage.PAGE_TITLE;
import static cz.moneta.test.dsl.hypos.pages.contract.documents.DocumentSignPage.SAVE_BUTTON;

@Wait({PAGE_TITLE, SAVE_BUTTON})
public interface DocumentSignPage extends HyposPageFlow<DocumentSignPage> {
    String PAGE_TITLE = "//h2[contains(text(),'Podpis dokumentu')]";
    String SIGNATURE_DATE_CLIENT_INPUT = "//input[@id='dateClient']";
    String BANKER_NAME_LABEL = "//label[@for='contactName']";
    String SAVE_BUTTON = "//button[@id='butt-sign']";
    String SIGNATURE_DATE_LOADER_DIV = "//div[@class='loading-overlay']";

    @TypeInto(SIGNATURE_DATE_CLIENT_INPUT)
    DocumentSignPage fillSignatureDateByClient(String signDate);

    @Click(SAVE_BUTTON)
    ContractHistoryPage clickSave();

    @Click(value = BANKER_NAME_LABEL, andWait = @Wait(value = SIGNATURE_DATE_LOADER_DIV, until = Until.GONE))
    DocumentSignPage clickBankerName();
}