package cz.moneta.test.dsl.newib.settings.communication.contacts;

import cz.moneta.test.dsl.newib.NewIbPageFlow;
import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.newib.settings.communication.contacts.PersonalAndContactDetailsPage.*;

@Wait(value = {TITLE_XPATH, NAME_AND_SURNAME_XPATH, PERMANENT_ADDRESS_XPATH, CONTACT_ADDRESS_XPATH}, waitSecondsForElement = 30)
public interface PersonalAndContactDetailsPage extends NewIbPageFlow<PersonalAndContactDetailsPage> {

    String TITLE_XPATH = "//h4[@class='t-title t-title--h3'][text()='Osobní a kontaktní údaje']";
    String PERMANENT_FIRST_NAME_XPATH = "//p[@data-testid='firstName']";
    String PERMANENT_LAST_NAME_XPATH = "//p[@data-testid='lastName']";
    String PERMANENT_TITLE_XPATH = "//p[@data-testid='titleBefore']";
    String PERMANENT_STREET_XPATH = "//p[@data-testid='permanentAddress-street']";
    String PERMANENT_CITY_XPATH = "//p[@data-testid='permanentAddress-city']";
    String PERMANENT_ZIP_XPATH = "//p[@data-testid='permanentAddress-zip']";
    String PERMANENT_COUNTRY_XPATH = "//p[@data-testid='permanentAddress-country']";
    String CONTACT_STREET_XPATH = "//p[@data-testid='contact-street']";
    String CONTACT_CITY_XPATH = "//p[@data-testid='contact-city']";
    String CONTACT_ZIP_XPATH = "//p[@data-testid='contact-zip']";
    String CONTACT_COUNTRY_XPATH = "//p[@data-testid='contact-country']";
    String CONTACT_MOBILE_XPATH = "//p[@data-testid='contact-mobile']";
    String CONTACT_EMAIL_XPATH = "//p[@data-testid='contact-email']";
    String ALERT_TEXT_XPATH = "//p[@data-testid='TextComponent']//small[text()='Změna jména, trvalé adresy nebo dokladu totožnosti je momentálně možná pouze na pobočce nebo v mobilní aplikaci.']";
    String EDIT_BUTTON_XPATH = "//button[@data-testid='edit-button' and text()='Upravit']";
    String EDIT_TITLE_XPATH = "//h2[@class='t-title t-title--h3'][text()='Upravit kontaktní údaje']";
    String CHECKBOX_XPATH = "//input[@type='checkbox'][@value='true']";
    String CHECKBOX_BTN_XPATH = "//label[@for='contactSameAsPermanentAddress']//span[text()='Kontaktní adresa je stejná jako trvalá adresa']";
    String STREET_DISABLED_XPATH = "//input[@id='street'][@disabled]";
    String DESCRIPTIVE_NUMBER_DISABLED_XPATH = "//input[@id='descriptiveNumber'][@disabled]";
    String ORIENTATION_NUMBER_DISABLED_XPATH = "//input[@id='orientationNumber'][@disabled]";
    String TOWN_DISABLED_XPATH = "//input[@id='town'][@disabled]";
    String ZIP_DISABLED_XPATH = "//input[@id='zip'][@disabled]";
    String COUNTRY_DISABLED_XPATH = "//button[@name='country'][@disabled]";
    String CONFIRM_BTN_XPATH = "//button[@data-testid='submit-personal-info'][text()='Pokračovat']";
    String MOBILE_KEY_INPUT_XPATH = "//label[@for='mobileKey']//following-sibling::div//input[@id='mobileKey']";
    String MOBILE_KEY_SEND_BTN_XPATH = "//button[@data-testid='secondFactorSend']";
    String VICTORY_HEADER_XPATH = "//h4[@class='t-title t-title--h4'][text()='Vaše kontaktní údaje byly upraveny']";
    String VICTORY_SENTENCE_XPATH = "//p[@data-testid='TextComponent'][text()='Změna se projeví nejpozději následující pracovní den.']";
    String SUBMIT_BTN_XPATH = "//button[@data-testid='submit'][text()='Zpět na Kontaktní údaje']";
    String MOBILE_PHONE_DISABLED_XPATH= "//input[@id='mobilePhone'][@disabled]";
    String EMAIL_ENABLED_XPATH = "//input[@id='email'][not(@disabled)]";
    String NAME_AND_SURNAME_XPATH = "//div[@class='u-mb--large u-fontWeightBold'][text()='Jméno a příjmení']";
    String PERMANENT_ADDRESS_XPATH = "//div[@class='u-mb--large u-mt--large u-fontWeightBold'][text()='Trvalá adresa']";
    String CONTACT_ADDRESS_XPATH = "//div[@class='u-mb--large u-mt--large u-fontWeightBold'][text()='Kontaktní údaje']";
    String STREET_INPUT_XPATH = "//input[@id='street']";
    String STREET_ERROR_MESSAGE_XPATH = "//div[@id='street_errorMessage'][text()='Toto pole je povinné.']";

    @CheckElementPresent(TITLE_XPATH)
    PersonalAndContactDetailsPage checkTitleIsPresent();

    @CheckElementContent(value = PERMANENT_FIRST_NAME_XPATH, by = Lookup.XPATH)
    PersonalAndContactDetailsPage checkPermanentFirstNameIsPresent(String firstName);

    @CheckElementContent(value = PERMANENT_LAST_NAME_XPATH, by = Lookup.XPATH)
    PersonalAndContactDetailsPage checkPermanentLastNameIstpresent(String lastName);

    @CheckElementContent(value = PERMANENT_TITLE_XPATH, by = Lookup.XPATH)
    PersonalAndContactDetailsPage checkPermanentTitleIsPresent(String title);

    @CheckElementContent(value = PERMANENT_STREET_XPATH, by = Lookup.XPATH)
    PersonalAndContactDetailsPage checkPermanentStreetIsPresent(String street);

    @CheckElementContent(value = PERMANENT_CITY_XPATH, by = Lookup.XPATH)
    PersonalAndContactDetailsPage checkPermanentCityIsPresent(String city);

    @CheckElementContent(value = PERMANENT_ZIP_XPATH, by = Lookup.XPATH)
    PersonalAndContactDetailsPage checkPermanentZipIsPresent(String zip);

    @CheckElementContent(value = PERMANENT_COUNTRY_XPATH, by = Lookup.XPATH)
    PersonalAndContactDetailsPage checkPermanentCountryIsPresent(String country);

    @CheckElementContent(value = CONTACT_STREET_XPATH, by = Lookup.XPATH)
    PersonalAndContactDetailsPage checkContactStreetIsPresent(String street);

    @CheckElementContent(value = CONTACT_CITY_XPATH, by = Lookup.XPATH)
    PersonalAndContactDetailsPage checkContactCityIsPresent(String city);

    @CheckElementContent(value = CONTACT_ZIP_XPATH, by = Lookup.XPATH)
    PersonalAndContactDetailsPage checkContactZipIsPresent(String zip);

    @CheckElementContent(value = CONTACT_COUNTRY_XPATH, by = Lookup.XPATH)
    PersonalAndContactDetailsPage checkContactCountrytIsPresent(String country);

    @CheckElementContent(value = CONTACT_MOBILE_XPATH, by = Lookup.XPATH)
    PersonalAndContactDetailsPage checkContactMobileIsPresent(String mobile);

    @CheckElementContent(value = CONTACT_EMAIL_XPATH, by = Lookup.XPATH)
    PersonalAndContactDetailsPage checkContactEmailIsPresent(String email);

    @CheckElementPresent(ALERT_TEXT_XPATH)
    PersonalAndContactDetailsPage checkAlertTextIsPresent();

    @Click(EDIT_BUTTON_XPATH)
    PersonalAndContactDetailsPage clickOnEdit();

    @CheckElementPresent(EDIT_TITLE_XPATH)
    PersonalAndContactDetailsPage checkEditTitleIsPresent();

    @CheckElementPresent(CHECKBOX_XPATH)
    PersonalAndContactDetailsPage checkCheckboxIsCheck();

    @CheckElementPresent(STREET_DISABLED_XPATH)
    PersonalAndContactDetailsPage checkStreetIsDisable();

    @CheckElementPresent(DESCRIPTIVE_NUMBER_DISABLED_XPATH)
    PersonalAndContactDetailsPage checkDescriptiveNumberIsDisable();

    @CheckElementPresent(ORIENTATION_NUMBER_DISABLED_XPATH)
    PersonalAndContactDetailsPage checkOrientationNumberIsDisable();

    @CheckElementPresent(TOWN_DISABLED_XPATH)
    PersonalAndContactDetailsPage checkTownIsDisable();

    @CheckElementPresent(ZIP_DISABLED_XPATH)
    PersonalAndContactDetailsPage checkZipIsDisable();

    @CheckElementPresent(COUNTRY_DISABLED_XPATH)
    PersonalAndContactDetailsPage checkCountryIsDisable();

    @Click(CHECKBOX_BTN_XPATH)
    PersonalAndContactDetailsPage clickOnCheckbox();

    @Click(CONFIRM_BTN_XPATH)
    PersonalAndContactDetailsPage clickOnConfirmButton();

    @TypeInto(MOBILE_KEY_INPUT_XPATH)
    PersonalAndContactDetailsPage fillMobileKey(String mobileKey);

    @Click(MOBILE_KEY_SEND_BTN_XPATH)
    PersonalAndContactDetailsPage clickOnConfirm();

    @CheckElementPresent(VICTORY_HEADER_XPATH)
    PersonalAndContactDetailsPage checkVictoryHeaderIsPresent();

    @CheckElementPresent(VICTORY_SENTENCE_XPATH)
    PersonalAndContactDetailsPage checkVictorySentenceIsPresent();

    @Click(SUBMIT_BTN_XPATH)
    PersonalAndContactDetailsPage clickOnSubmitButton();

    @CheckElementPresent(MOBILE_PHONE_DISABLED_XPATH)
    PersonalAndContactDetailsPage checkMobilePhoneIsDisable();

    @CheckElementPresent(EMAIL_ENABLED_XPATH)
    PersonalAndContactDetailsPage checkEmailIsEnable();

    @TypeInto(value = STREET_INPUT_XPATH, clear = true)
    PersonalAndContactDetailsPage fillStreet(String street);

    @CheckElementPresent(STREET_ERROR_MESSAGE_XPATH)
    PersonalAndContactDetailsPage checkStreetErrorMessage();
}