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

import cz.moneta.test.harness.support.util.Level;

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;

/**
 * Log some value obtained using lookup_value to log file using {@link #level()}<br>
 * <u>Example:</u>
 *    <pre>
 *         {@literal @}Log (LOOKUP_VALUE)
 *          SomePage goToPageOrWhatever();
 *    </pre>
 * {@link #by()} could be used for other then default type of element search.
 * <u>Example2:</u><br>
 *    <pre>
 *         {@literal @}Log {
 *               level = Level.INFO,
 *               value = SOME_XPATH,
 *               by = Lookup.XPATH,
 *               template = "[]"
 *          )
 *          SomePage goToPageOrWhatever();
 *    </pre>
 */
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(Logs.class)
public @interface Log {
    /**
     * Logging level.
     * @see Level
     */
    Level level() default Level.INFO;

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

    /**
     * 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;

    /**
     * Template for logging entry (default "{}").
     */
    String template() default "{}";
}
