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

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

import java.lang.annotation.*;

/**
 * Click annotation is used for click on element.<br>
 * Dynamic path functionality is supported. See {@link cz.moneta.test.harness.support.web.DynamicPathPart}
 * for use or open  @see <a href="https://confluence.moneta.cz/display/CONT/Dynamic+Elements">Confluence Best Practises page</a><br>
 * <u>Example:</u>
 *    <pre>
 *         {@literal @}AndroidClick (SOME_VALUE)
 *          SomePage simpleClick();
 *    </pre>
 * {@link #andWait()} Used for wait to element after click.<br>
 * <u>Example2:</u>
 *    <pre>
 *         {@literal @}AndroidClick{
 *               value = SOME_VALUE,
 *               andWait = {@literal @}AndroidWait(value = XPATH, by = MobileLookup.XPATH),
 *          )
 *          SomePage someClickWithWait();
 *    </pre>
 * {@link #by()} could be used for other then default type of element search.
 * <u>Example3:</u><br>
 *    <pre>
 *         {@literal @}AndroidClick{
 *               value = SOME_XPATH,
 *               by = MobileLookup.XPATH,
 *          )
 *          SomePage clickToSomeElementByXpath();
 *    </pre>
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(AndroidClicks.class)
public @interface AndroidClick {
    /**
     * Value for element identification.
     */
    String value() default "";

    /**
     * Wait for element after click. See {@literal @}{@link AndroidWait} annotation.
     */
    AndroidWait andWait() default @AndroidWait;

    /**
     * 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 will be used input String parameter of method to substitute %s in xpath.
     */
    boolean isStringDynamicXpath() default false;
}
