package net.pagejects.core.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * User action: click on the element
 *
 * Element will be determine in runtime by selector (by {@link PageObject#value() page object name} and by
 * {@link #elementName() element name})
 *
 * @author Andrey Paslavsky
 * @since 0.1
 */
@PublicAPI
@Documented
@UserAction
@Retention(RUNTIME) @Target(METHOD)
public @interface Click {
    /**
     * Return element name to determine selector of the element
     * @return element name
     */
    String elementName();

    /**
     * Returns click type. By default will be triggered simple click
     *
     * @return click type
     */
    ClickType type() default ClickType.CLICK;

    /**
     * Wait before click. By default - disabled
     *
     * @return wait settings
     */
    Wait waiteBefore() default @Wait();

    /**
     * Wait after click. By default - disabled
     *
     * @return wait settings
     */
    Wait waiteAfter() default @Wait();

    /**
     * Enumeration of the click types
     */
    enum ClickType {
        /**
         * Simple click
         */
        CLICK,

        /**
         * Double click
         */
        DOUBLE_CLICK,

        /**
         * Context click
         */
        CONTEXT_CLICK
    }
}
