package cz.moneta.test.harness.support.mobile.android;

import cz.moneta.test.harness.support.mobile.MobileLookup;
import cz.moneta.test.harness.support.mobile.share.Direction;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Scroll annotation is used for scroll using direction.<br>
 * <u>Example:</u>
 * <pre>
 *         {@literal @}@AndroidScroll(direction = Direction.SOME_DIRECTION)
 *          SomePage simpleScroll();
 *    </pre>
 * {@link #untilElementPresent()} Used for scroll to element.<br>
 * <u>Example2:</u>
 * <pre>
 *         {@literal @}AndroidScroll{
 *               direction = Direction.SOME_DIRECTION,
 *               untilElementPresent = "SOME_PATH"
 *               )
 *          SomePage someScrollUntilElementIsPresent();
 *    </pre>
 * {@link #by()} could be used for other then default type of element search.
 * <u>Example3:</u><br>
 * <pre>
 *         {@literal @}AndroidScroll{
 *               direction = Direction.SOME_DIRECTION,
 *               untilElementPresent = "SOME_PATH",
 *               by = MobileLookup.XPATH,
 *          )
 *          SomePage someScrollUntilElementIsPresent();
 *    </pre>
 * {@link #by()} could be used for scroll until element is present and then click on that element.
 * <u>Example4:</u><br>
 * <pre>
 *          {@literal @}AndroidScroll{
 *                direction = Direction.SOME_DIRECTION,
 *                untilElementPresent = "SOME_PATH",
 *                by = MobileLookup.XPATH,
 *                andClick = true
 *            )
 *            SomePage someScrollUntilElementAndClick();
 *      </pre>
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface AndroidScroll {
    /**
     * Direction for scrolling
     * UP, DOWN, LEFT, RIGHT can be used
     */
    Direction direction() default Direction.DEFAULT;

    /**
     * Will keep scrolling until element is present.
     * Value for identification of element.
     */
    String untilElementPresent() default "";

    /**
     * Click on element after scroll.
     */
    boolean andClick() default false;

    /**
     * Type of element identification which will be used for element search. XPATH, ID or DEFAULT can be used.
     *
     * @see MobileLookup
     */
    MobileLookup by() default MobileLookup.DEFAULT;
}