package cz.moneta.test.dsl.ufo.banka.pages.products.sme;

import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.ufo.banka.pages.products.sme.KUL064_S001_AddingEditingPersonPage.*;
import static cz.moneta.test.dsl.ufo.operations.shared.SharedElements.LOAD_IMG_DIV_CLASS;

@Wait(value = KUL006_S001_PAGE_LABEL_XPATH, by = Lookup.XPATH, waitSecondsForElement = 60)
@Wait(NEXT_BUTTON)
public interface KUL064_S001_AddingEditingPersonPage extends WebFlow<KUL064_S001_AddingEditingPersonPage> {
    String KUL006_S001_PAGE_LABEL_XPATH = "//div[text()='KUL064_S001']";

    String NEXT_BUTTON = "KUL064_S001_B003";

    String ORIENTATION_NUMBER_INPUT = "KUL064_S001_E002";
    String FIRST_NAME_INPUT = "KUL064_S001_E013";
    String LAST_NAME_INPUT = "KUL064_S001_E015";
    String BIRTH_NUMBER_INPUT = "KUL064_S001_E017";

    String CZECH_FLAG_RESIDENCY_BUTTON = "KUL064_S001_P001";
    String MAGNIFYING_GLASS_BUTTON = "KUL064_S001_P003";
    String ADDRESS_LOOKUP_TABLE = "XXX001_T001_X007";

    String CONSENT_PERSONALLY_SIGNED_RADIO = "KUL064_S001_R001_SIGN";

    String ADDRESS_SEARCH_INPUT = "XXX000_T001_E110";
    String SEARCH_ADDRESS_BUTTON = "XXX000_T001_B100";
    String FIRST_FOUND_ADDRESS_RADIO = "XXX000_T001_G100-0";

    @TypeInto(FIRST_NAME_INPUT)
    KUL064_S001_AddingEditingPersonPage fillFirstName(String firstName);

    @TypeInto(LAST_NAME_INPUT)
    KUL064_S001_AddingEditingPersonPage fillLastName(String lastName);

    @TypeInto(value = BIRTH_NUMBER_INPUT, andWait = @Wait(value = LOAD_IMG_DIV_CLASS, by = Lookup.CLASSNAME, until = Until.GONE, waitSecondsForElement = 60))
    KUL064_S001_AddingEditingPersonPage fillBirthNumber(String birthNumber);

    @Click(CZECH_FLAG_RESIDENCY_BUTTON)
    KUL064_S001_AddingEditingPersonPage clickCzechResidency();

    @Click(value = MAGNIFYING_GLASS_BUTTON, andWait = @Wait(value = ADDRESS_LOOKUP_TABLE, until = Until.VISIBLE))
    KUL064_S001_AddingEditingPersonPage clickAddressLookupMagnifyGlass();

    @TypeInto(ADDRESS_SEARCH_INPUT)
    KUL064_S001_AddingEditingPersonPage fillSearchedAddress(String searchedAddress);

    @Click(value = SEARCH_ADDRESS_BUTTON, andWait = @Wait(value = FIRST_FOUND_ADDRESS_RADIO, until = Until.VISIBLE, waitSecondsForElement = 60))
    @Click(value = FIRST_FOUND_ADDRESS_RADIO, andWait = @Wait(value = LOAD_IMG_DIV_CLASS, by = Lookup.CLASSNAME, until = Until.GONE, waitSecondsForElement = 60))
    KUL064_S001_AddingEditingPersonPage searchAddressAndSelectFirst();

    @Click(CONSENT_PERSONALLY_SIGNED_RADIO)
    KUL064_S001_AddingEditingPersonPage clickConsentPersonallySigned();

    @Click(NEXT_BUTTON)
    KUL006_S001_ListOfPersonsOnRequestPage clickNextToListOfPersonsOnRequestPage();
}
