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

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

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

/**
 * Checks if element is present, if not TimeoutException is thrown. <br>
 * Dynamic path functionality is supported. See {@link cz.moneta.test.harness.support.web.DynamicPathPart}
 * for use or open  @see <a https://confluence.moneta.cz/pages/viewpage.action?pageId=1309104896">Confluence Best Practises page</a><br>
 * <u>Example:</u>
 * <pre>
 *        {@literal @}IosCheckElementPresent (SOME_VALUE)
 *          SomePage someElement();
 *    </pre>
 * {@link #by()} can be used when there is need to use other than default lookup function.<br>
 * {@link #isStringDynamicXpath()} - Use to set String from method in xpath. Boolean type. The default value is: false.<br>
 *
 * <u>Example2:</u>
 * <pre>
 *        {@literal @}IosCheckElementPresent (value = SOME_XPATH_VALUE,
 *                                         by = Lookup.XPATH)
 *          SomePage someElement();
 *    </pre>
 * {@link #by()} could be used for other then default type of element search.
 * <u>Example3:</u><br>
 * <pre>
 *         {@literal @}IosCheckElementPresent{
 *               value = SOME_XPATH,
 *               by = Lookup.XPATH,
 *          )
 *          SomePage someElement();
 *    </pre>
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface IosCheckElementPresent {

    /**
     * Value for element identification.
     */
    String value();

    /**
     * Type of element identification which will be used for element search. XPATH, IOS_NAME, 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;
}