package cz.moneta.test.harness.support.mobile.ios;

import cz.moneta.test.harness.connectors.mobile.ios.HideIosKeyboardButton;
import cz.moneta.test.harness.support.mobile.MobileLookup;

import java.lang.annotation.*;

/**
 * AndroidTypeInto annotation is used for write some value to element.<br>
 * This annotation does not support dynamic path construction.<br>
 * <u>Example:</u>
 * <pre>
 *        {@literal @}IosTypeInto (SOME_VALUE)
 *         SomePage fillElement(String text);
 *    </pre>
 * Element can be cleared before write using {@link #clear()}.<br>
 * {@link #hideKeyboardAfterType()} is used for hide mobile default keyboard after fill the text,
 * default is true, use false if you don't need to hide a keyboard. <br>
 * <u>Example2:</u>
 * <pre>
 *           {@literal @}IosTypeInto{
 *            &emsp;value = SOME_VALUE,
 *            &emsp;hideKeyboardAfterType = false
 *           )
 *           SomePage fillElement(String text);
 *  </pre>
 * {@link #andWait()} is used for wait to other element after fill. <br>
 * <u>Example3:</u>
 * <pre>
 *          {@literal @}IosTypeInto{
 *             &emsp;value = SOME_VALUE,
 *             &emsp;clear = true,
 *             &emsp;andWait = @Wait(forXpath = "xpath of element to wait", waitSecondsForElement = 50),
 *           )
 *           SomePage fillElement(String text);
 *    </pre>
 * {@link #by()} could be used for other then default type of element search.
 * <u>Example4:</u><br>
 * <pre>
 *         {@literal @}IosTypeInto{
 *               value = SOME_XPATH,
 *               by = MobileLookup.XPATH,
 *          )
 *          SomePage fillElement(String text);
 *    </pre>
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(IosTypeIntos.class)
public @interface IosTypeInto {
    /**
     * 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;

    /**
     * Set false if you don't want to hide a mobile keyboard after the type action.
     */
    boolean hideKeyboardAfterType() default true;

    /**
     * Type of element identification which will be used for hide ios keyboard. DONE, RETURN, GO, ENTER can be used.
     *
     * @see HideIosKeyboardButton
     */
    HideIosKeyboardButton hideButton() default HideIosKeyboardButton.DONE;

    /**
     * Wait for element show after typing. Use {@literal @}{@link Wait} annotation. Tool is not waiting for any element by default.
     */
    IosWait andWait() default @IosWait;

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