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

import cz.moneta.test.dsl.hypos.pages.HyposPageFlow;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.FileUpload;
import cz.moneta.test.harness.support.web.Select;
import cz.moneta.test.harness.support.web.TypeInto;
import cz.moneta.test.harness.support.web.Wait;

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

@Wait({PAGE_TITLE, IMPORTED_DOCUMENT_TYPE_SELECT, SAVE_BUTTON})
public interface DocumentImportPage extends HyposPageFlow<DocumentImportPage> {
    String PAGE_TITLE = "//h1[text()='Import dokumentu']";
    String IMPORTED_DOCUMENT_TYPE_SELECT = "//select[@id='import-doc-type']";
    String DOCUMENT_CATEGORY_SELECT = "//select[@id='document-category']";
    String DOCUMENT_TYPE_SELECT = "//select[@id='document-type']";
    String DOCUMENT_CLASSIFICATION_SELECT = "//select[@id='document-classification']";
    String FILE_NAME_INPUT = "//input[@id='suffix']";
    String FILE_UPLOAD_INPUT = "//input[@id='importedFile']";
    String SAVE_BUTTON = "//input[@id = 'submit-button' and @value='Uložit']";

    @Select(IMPORTED_DOCUMENT_TYPE_SELECT)
    DocumentImportPage selectImportedDocumentType(String documentType);

    @Wait(DOCUMENT_CATEGORY_SELECT)
    @Select(DOCUMENT_CATEGORY_SELECT)
    DocumentImportPage selectDocumentCategory(String documentCategory);

    @Select(DOCUMENT_TYPE_SELECT)
    DocumentImportPage selectDocumentType(String documentType);

    @Select(DOCUMENT_CLASSIFICATION_SELECT)
    DocumentImportPage selectDocumentClassification(String documentClassification);

    @TypeInto(value = FILE_NAME_INPUT, clear = true)
    DocumentImportPage fillDocumentName(String name);

    @FileUpload(FILE_UPLOAD_INPUT)
    DocumentImportPage uploadFile(String filePath);

    @Click(SAVE_BUTTON)
    DocumentsPage clickSave();
}
