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

import java.lang.annotation.*;

/**
 * FileUpload annotation is used to upload a file by using relative path.<br>
 * This annotation does not support dynamic path construction.<br>
 * <u>Example:</u>
 *    <pre>
 *        {@literal @}FileUpload (SOME_VALUE)
 *         SomePage uploadIdScan(String text);
 *    </pre>
 * Element can be cleared before write using {@link #clear()}.<br>
 * {@link #andWait()} is used for wait to other element after fill. <br>
 * <u>Example2:</u>
 *    <pre>
 *          {@literal @}FileUpload{
 *             &emsp;value = SOME_VALUE,
 *             &emsp;clear = true,
 *             &emsp;andWait = @Wait(forXpath = "xpath of element to wait", waitSecondsForElement = 50),
 *           )
 *           SomePage uploadIdScan(String text);
 *    </pre>
 * {@link #by()} could be used for other then default type of element search.
 * <u>Example3:</u><br>
 *    <pre>
 *         {@literal @}FileUpload{
 *               value = SOME_XPATH,
 *               by = Lookup.XPATH,
 *          )
 *          SomePage uploadIdScan(String text);
 *    </pre>
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(FileUploads.class)
public @interface FileUpload {
    /**
     * Value for identification of element. XPATH or ID of element can be used.
     */
    String value();

    /**
     * Set true if want to clear element before write.
     */
    boolean clear() default false;

    /**
     * Wait for element show after typing. Use {@literal @}{@link Wait} annotation. Tool is not waiting for any element by default.
     */
    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. In container of method with FileUpload annotation you must have everywhere use just normal xpath or dynamic xpath!
     */
    boolean isStringDynamicXpath() default false;
}