package cz.moneta.test.harness.support.web;

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

/**
 * 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 @}Click (SOME_VALUE)
 *          SomePage simpleClick();
 *    </pre>
 * {@link #jsClick()} is used when standard click not works.
 * {@link #andWait()} Used for wait to element after click.<br>
 * {@link #isStringDynamicXpath()} - Use to set String from method in xpath. Boolean type. The default value is: false.<br>
 * <u>Example2:</u>
 * <pre>
 *         {@literal @}Click{
 *               value = SOME_VALUE,
 *               andWait = {@literal @}Wait(value = XPATH, by = Lookup.XPATH),
 *               jsClick = true
 *          )
 *          SomePage someClickWithWaitAndJSClick();
 *    </pre>
 * {@link #by()} could be used for other then default type of element search.
 * <u>Example3:</u><br>
 * <pre>
 *         {@literal @}Click{
 *               value = SOME_XPATH,
 *               by = Lookup.XPATH,
 *          )
 *          SomePage clickToSomeElementByXpath();
 *    </pre>
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(Clicks.class)
public @interface Click {

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

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

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

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

    /**
     * If set true will be used input String parameter of method to substitute %s in xpath.
     */
    boolean isStringDynamicXpath() default false;
}