package cz.moneta.test.dsl.ufo.banka.pages.cards.debit;

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

import static cz.moneta.test.dsl.ufo.banka.pages.cards.debit.MBC006_S001_PersonalContactDataPage.*;
import static cz.moneta.test.dsl.ufo.operations.shared.SharedElements.LOAD_IMG_DIV_CLASS;

@Wait(value = MBC006_S001_PAGE_LABEL_XPATH, by = Lookup.XPATH, waitSecondsForElement = 120)
public interface MBC006_S001_PersonalContactDataPage extends WebFlow<MBC006_S001_PersonalContactDataPage> {
    String MBC006_S001_PAGE_LABEL_XPATH = "//div[text()='MBC006_S001']";

    String CONTINUE_BUTTON = "MBC006_S001_B001";
    String UNIFIED_ADDRESS_LOOKUP_BUTTON = "MBC006_S001_B006";
    String CZECH_FLAG_BUTTON = "MBC006_S001_B007";
    String FOUND_ADDRESS_SELECT_BUTTON = "MBC006_S001_B012";
    String ADDRESS_LOOKUP_FLOAT_BUTTON = "MBC006_S001_B013";

    String EDUCATION_LEVEL_SELECT = "MBC006_S001_C002";
    String MARITAL_STATUS_SELECT = "MBC006_S001_C003";

    String EMAIL_INPUT = "MBC006_S001_E001";
    String PHONE_INPUT = "MBC006_S001_E002";
    String SEARCH_ADDRESS_INPUT = "MBC006_S001_E010";

    String FIRST_FOUND_ADDRESS_RADIO = "MBC006_S001_G001-0";
    String CONSENTS_PHONE_EMAIL_CHECK = "MBC006_S001_H001_1";
    String CONSENTS_WHATSAPP_CHECK = "MBC006_S001_H002_1";

    @Click(UNIFIED_ADDRESS_LOOKUP_BUTTON)
    MBC006_S001_PersonalContactDataPage clickMagnifyingGlass();

    @Wait(explicitWaitSeconds = 2)
    @TypeInto(value = SEARCH_ADDRESS_INPUT, clear = true)
    MBC006_S001_PersonalContactDataPage typeAddress(String searchAddress);

    @Click(value = ADDRESS_LOOKUP_FLOAT_BUTTON, andWait = @Wait(value = FIRST_FOUND_ADDRESS_RADIO, until = Until.VISIBLE))
    MBC006_S001_PersonalContactDataPage clickSearchForAddress();

    @Click(FIRST_FOUND_ADDRESS_RADIO)
    @Click(value = FOUND_ADDRESS_SELECT_BUTTON, andWait = @Wait(value = LOAD_IMG_DIV_CLASS, by = Lookup.CLASSNAME, until = Until.GONE))
    MBC006_S001_PersonalContactDataPage clickFirstFoundAddressAndConfirm();

    @Click(value = CZECH_FLAG_BUTTON, jsClick = true)
    MBC006_S001_PersonalContactDataPage clickCzechResidency();

    @TypeInto(EMAIL_INPUT)
    MBC006_S001_PersonalContactDataPage fillEmail(String email);

    @TypeInto(PHONE_INPUT)
    MBC006_S001_PersonalContactDataPage fillPhone(String phone);

    @Select(EDUCATION_LEVEL_SELECT)
    MBC006_S001_PersonalContactDataPage selectEducationLevel(String educationLevel);

    @Select(MARITAL_STATUS_SELECT)
    MBC006_S001_PersonalContactDataPage selectMaritalStatus(String maritalStatus);

    @Click(value = CONSENTS_PHONE_EMAIL_CHECK, jsClick = true)
    @Click(value = CONSENTS_WHATSAPP_CHECK, jsClick = true)
    MBC006_S001_PersonalContactDataPage checkConsents();

    @Click(CONTINUE_BUTTON)
    MBC007_S001_PersonalDataSummaryPage clickContinueToMbcSummaryPage();
}
