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 cz.moneta.test.harness.support.web.Lookup;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
 * Select annotation is used for pick {@link #value()} from select (list of values) by text parameter.
 * String parameter is used for identify element and text parameter is used for searching by select value.<br>
 * String/text parameter type is mandatory. IllegalStateException is thrown if not added.<br>
 * This annotation does not support dynamic path construction.<br>
 *
 * <u>Example:</u>
 * <pre>
 *         {@literal @}AndroidSelect (SOME_VALUE)
 *          SomePage selectSomeValue(String text);
 *    </pre>
 * {@link #by()} could be used for other then default type of element search.<br>
 * <u>Example2:</u><br>
 * <pre>
 *         {@literal @}AndroidSelect {
 *               value = SOME_XPATH,
 *               by = Lookup.XPATH,
 *          )
 *          SomePage selectSomeValue(String text);
 *    </pre>
 * {@link #scrollToValue()} set direction if you need to use scroll to text
 * <u>Example3:</u><br>
 * <pre>
 *          value(); //this will select first option in select with identificator 'SOME_VALUE'
 *
 *         {@literal @}AndroidSelect {
 *               value = SOME_VALUE,
 *               scrollToValue = Direction.DOWN,
 *          )
 *          SomePage selectSomeValue(String text);
 *    </pre>
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface AndroidSelect {
    /**
     * Value for element identification.
     */
    String value();

    /**
     * Direction for scrolling
     * UP, DOWN, can be used
     */
    Direction scrollToValue() default Direction.DEFAULT;

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

}