package cz.moneta.test.dsl.ib.loans.flexicredit.request;

import cz.moneta.test.dsl.ib.IbPageFlow;
import cz.moneta.test.dsl.ib.loans.flexicredit.FlexicreditApplicationPage;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.ib.loans.flexicredit.request.RequestAdressFlexicreditApplicationPage.COUNTRY;
import static cz.moneta.test.dsl.ib.loans.flexicredit.request.RequestAdressFlexicreditApplicationPage.DESCRIPTIVE_NUMBER;
import static cz.moneta.test.dsl.ib.loans.flexicredit.request.RequestAdressFlexicreditApplicationPage.MAILING_ADDRESS;
import static cz.moneta.test.dsl.ib.loans.flexicredit.request.RequestAdressFlexicreditApplicationPage.NAME;
import static cz.moneta.test.dsl.ib.loans.flexicredit.request.RequestAdressFlexicreditApplicationPage.ORIENTATION_NUMBER;
import static cz.moneta.test.dsl.ib.loans.flexicredit.request.RequestAdressFlexicreditApplicationPage.SECOND_HEADER_TEXT;
import static cz.moneta.test.dsl.ib.loans.flexicredit.request.RequestAdressFlexicreditApplicationPage.SURNAME;
import static cz.moneta.test.dsl.ib.loans.flexicredit.request.RequestAdressFlexicreditApplicationPage.TOWN;
import static cz.moneta.test.dsl.ib.loans.flexicredit.request.RequestAdressFlexicreditApplicationPage.ZIP;

//TODO:add assert for data
@Wait({SECOND_HEADER_TEXT, NAME, SURNAME, DESCRIPTIVE_NUMBER, ORIENTATION_NUMBER, ZIP, TOWN, COUNTRY, MAILING_ADDRESS})
public interface RequestAdressFlexicreditApplicationPage extends IbPageFlow<RequestAdressFlexicreditApplicationPage>, FlexicreditApplicationPage {
    String SECOND_HEADER_TEXT = "//span[text() = 'Máme správně Vaše kontaktní údaje?']";

    //Contact
    String NAME = "//span[text()='Jméno']//parent::label//following::input[@name= 'person.name']";
    String SURNAME = "//span[text()='Příjmení']//parent::label//following::input[@name= 'person.surname']";
    String STREET = "//span[text()='Ulice']//parent::label//following::input[@name= 'permanentAddress.street']";

    //Address
    String DESCRIPTIVE_NUMBER = "//span[text()='Č. popisné / orientační']//parent::label//following::input[@name= 'permanentAddress.descriptiveNumber']";
    String ORIENTATION_NUMBER = "//input[@name= 'permanentAddress.orientationNumber']";
    String ZIP = "//span[text()='PSČ']//parent::label//following::input[@name= 'permanentAddress.zip']";
    String TOWN = "//span[text()='Obec / Město']//parent::label//following::input[@name= 'permanentAddress.town']";
    String COUNTRY = "//span[text()='Země']//parent::label//following::input[@name= 'permanentAddress.country']"; //TODO test to click on element

    String MAILING_ADDRESS = "//span[text()='Korespondenční adresa je odlišná od trvalého bydliště']//ancestor::label//input[@id = 'differentAddresses']";

    @Wait(CONTINUE_BUTTON)
    @Click(value = CONTINUE_BUTTON, jsClick = true)
    RequestRevenuesFlexicreditApplicationPage clickContinueButton();
}
