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

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

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 name parameter.
 * String parameter is used for identify element and name parameter is used for searching by select value.<br>
 * String/name 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 @}IosSelect (SOME_VALUE)
 *          SomePage selectSomeValue(String name);
 *    </pre>
 * {@link #by()} could be used for other then default type of element search.<br>
 * <u>Example2:</u><br>
 * <pre>
 *         {@literal @}IosSelect {
 *               value = SOME_XPATH,
 *               by = Lookup.XPATH,
 *          )
 *          SomePage selectSomeValue(String name);
 *    </pre>
 * {@link #scrollToValue()} set direction if you need to use scroll to name
 * <u>Example3:</u><br>
 * <pre>
 *          value(); //this will select first option in select with identificator 'SOME_VALUE'
 *
 *         {@literal @}IosSelect {
 *               value = SOME_VALUE,
 *               scrollToValue = Direction.DOWN,
 *          )
 *          SomePage selectSomeValue(String name);
 *    </pre>
 * {@link #jsScroll()} set true if you need to execute javaScript scroll
 * <u>Example3:</u><br>
 * <pre>
 *           {@literal @}IosSelect {
 *             value = SOME_VALUE,
 *             scrollToValue = Direction.DOWN,
 *             jsScroll = true
 *          )
 *         SomePage selectSomeValue(String name);
 *    </pre>
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface IosSelect {
    /**
     * 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 element search. XPATH, ID or DEFAULT can be used.
     *
     * @see MobileLookup
     */
    MobileLookup by() default MobileLookup.DEFAULT;

    /**
     * If set true javascript jsScroll will be done.
     */
    boolean jsScroll() default false;

}