package cz.moneta.test.dsl.auto.smartauto;

import cz.moneta.test.dsl.auto.smartauto.shared.BankCode;
import cz.moneta.test.dsl.auto.smartauto.shared.CommonElements;
import cz.moneta.test.harness.support.web.*;

public interface OthersPage extends SmartAutoFlow<OthersPage> {

    String VEHICLE_PAGE_VALIDATION = "//span[contains(text(), 'Předmět')]//following-sibling::span[contains(text(), '✓')]";
    String DEALER_CONTACT_PHONE_NUMBER = "//input[@name='sign.dealerContactPhoneNumber']";
    String ACCOUNT_NUMBER = "//input[@name='sign.bankContactC2C.accountNumber']";
    String BANK_CODE = "//span[contains(text(), 'Kód banky')]/../../..//input";
    String BUTTON = "//button[contains(text(), '%s')]";
    String APPROVAL_MESSAGE = "//h6[contains(text(), 'Zpráva pro schvalovatele')]/../../../div/div/span/textarea";
    String VEHICLE_PAGE = "//span[contains(text(), 'Předmět')]";
    String DUPLICATE_APPLICATION = "//span[contains(text(), 'Duplikovat')]";
    String CALCULATION_NAME = "//input[@name='calculationName']";
    String BUTTON_OK = "//span[contains(text(), 'Ok')]";
    String BUTTON_CONSUMER = "//span[contains(text(), 'Spotřebitel')]/..";
    String C2C_COMPANY_NAME = "//input[@name='sign.bankContactC2C.companyName']";
    String C2C_COMPANY_ICO = "//input[@name='sign.bankContactC2C.ico']";
    String C2C_FIRST_NAME = "//input[@name='sign.bankContactC2C.contactFirstName']";
    String C2C_SURNAME = "//input[@name='sign.bankContactC2C.contactSurname']";
    String C2C_BIRTH_DATE = "//label[contains(text(), 'Datum narození')]/../div/input";


    @CheckElementPresent(VEHICLE_PAGE_VALIDATION)
    OthersPage checkVehiclePageValidation();

    @TypeInto(DEALER_CONTACT_PHONE_NUMBER)
    OthersPage typeDealerContactPhoneNumber(int dealerContactphoneNumber);

    @TypeInto(ACCOUNT_NUMBER)
    OthersPage typeAccountNumber(int accountNumber);

    @TypeInto(BANK_CODE)
    OthersPage typeBankCode(String bankCode);

    @Click(BUTTON)
    OthersPage clickBankCode(BankCode bankCode);

    @TypeInto(APPROVAL_MESSAGE)
    OthersPage typeApprovalMessage(String approvalMessage);

    @Wait(value = VEHICLE_PAGE, until = Until.CLICKABLE)
    @Click(value = VEHICLE_PAGE, jsClick = true)
    VehiclePage clickVehiclePage();

    @Click(value = CommonElements.SAVE_CALCULATION_BUTTON, andWait = @Wait(value = CommonElements.SUCCESSFUL_SAVED_CALCULATION_MESSAGE), jsClick = true)
    OthersPage clickSaveCalculation();

    @Wait(value = DUPLICATE_APPLICATION, until = Until.CLICKABLE)
    @Click(value = DUPLICATE_APPLICATION, jsClick = true)
    OthersPage clickDuplicateApplication();

    @TypeInto(CALCULATION_NAME)
    OthersPage typeCalculationName(String calculationName);

    @Click(BUTTON_OK)
    VehiclePage clickDuplicateApplicationButtonOk();

    @Click(BUTTON_CONSUMER)
    OthersPage clickConsumer();

    @TypeInto(C2C_COMPANY_NAME)
    OthersPage typeC2CCompanyName(String c2cCompanyName);

    @TypeInto(C2C_COMPANY_ICO)
    OthersPage typeC2CCompanyIco(String c2cCompanyIco);

    @TypeInto(C2C_FIRST_NAME)
    OthersPage typeC2CFirstName(String c2cFirstName);

    @TypeInto(C2C_SURNAME)
    OthersPage typeC2CSurname(String c2cSurname);

    @TypeInto(C2C_BIRTH_DATE)
    OthersPage typeC2CBirthDate(String c2cBirthDate);
}