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

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

/**
 * Page annotation is used for transition to another page. Usually is used with other annotations (fe. with {@link Click}).<br>
 * <u>Example:</u>
 * <pre>
 *         {@literal @}Click (SOME_VALUE)
 *         {@literal @}Page (SomePage.class)
 *          SomePage clickAndGoToSomePage();
 * </pre>
 * {@link #url()} is used for direct open a specific page.<br>
 * <u>Example2:</u>
 * <pre>
 *         {@literal @}Page(
 *           value = SomePage.class,
 *           url = "https://www.somepage.cz"
 *           )
 *          SomePage directGoToSomePage();
 * </pre>
 * {@link #path()} is used for direct open a specific suffix in current page. For example when you are at page:
 * <pre>
 *     https://frontendtst/TST1/ufo/banka
 * </pre>
 * path parameter:
 * <pre>
 *     path = "/text"
 * </pre>
 * opens page:
 * <pre>
 *     https://frontendtst/TST1/ufo/banka/text
 * </pre>
 * <u>Example3:</u>
 * <pre>
 *         {@literal @}Page(
 *           value = SomePage.class,
 *           path = "/someSuffix"
 *           )
 *          SomePage directGoToSomePageSuffix();
 * </pre>
 * Parameters path and url are NOT combinable. When you add both of them only path will be evaluated.
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Page {
    /**
     * Class of next page. For example: SomePage.class.
     */
    Class<? extends WebFlow<?>> value();

    /**
     * Suffix of next page. Current url + suffix will be used.
     */
    String path() default "";

    /**
     * URL of next page.
     */
    String url() default "";

}
