package cz.moneta.test.dsl.payment_engine;

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

import static cz.moneta.test.dsl.payment_engine.PaymentEngineCreateReservationPage.SELECT_TYPE;

@Wait(SELECT_TYPE)
public interface PaymentEngineEditReservationPage extends WebFlow<PaymentEngineEditReservationPage> {

    String AMOUNT = "//input[@name = 'amt']";
    String DESCRIPTION_1 = "//input[@name = 'line1']";
    String DESCRIPTION_2 = "//input[@name = 'line2']";
    String DESCRIPTION_3 = "//input[@name = 'line3']";
    String SUBMIT_BUTTON = "//button[text()='OK']";

    String RESERVATION_ID_KEY = "RESERVATION_ID_KEY";
    String RESERVATION_ID_XPATH = "//input[@name = 'resId']";

    @TypeIntos({@TypeInto(value = AMOUNT, clear = true), @TypeInto(value = DESCRIPTION_1, clear = true),
            @TypeInto(value = DESCRIPTION_2, clear = true, andWait = @Wait(explicitWaitSeconds = 1))})
    PaymentEngineEditReservationPage fillManualData(String amount, String description_1, String description_2);

    @Click(value = SUBMIT_BUTTON, andWait = @Wait(value = SUBMIT_BUTTON, until = Until.GONE))
    PaymentEngineReservationPage clickSubmit();

    @StoreElementContent(storeKey = RESERVATION_ID_KEY, value = RESERVATION_ID_XPATH, by = Lookup.XPATH)
    PaymentEngineEditReservationPage getReservationId();
}