package cz.moneta.test.dsl.ib.messages;

import cz.moneta.test.dsl.ib.IbPageFlow;
import cz.moneta.test.dsl.ib.components.MainMenu;
import cz.moneta.test.dsl.ib.components.UserMenu;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.Lookup;
import cz.moneta.test.harness.support.web.Select;
import cz.moneta.test.harness.support.web.TypeInto;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.ib.messages.IbWriteNewMailPage.NEW_MESSAGE_HEADER_TEXT;

@Wait(NEW_MESSAGE_HEADER_TEXT)
public interface IbWriteNewMailPage extends IbPageFlow<IbWriteNewMailPage>, MainMenu, UserMenu, IbMailsLeftMenu {
    String NEW_MESSAGE_HEADER_TEXT = "//h3[text() = 'Napsat novou zprávu']";
    String MAIL_SUBJECT = "mail_subject";
    String MAIL_TOPIC_SELECT = "mail_topic";
    String MESSAGE_FORM = "mail_body";

    String SEND_BTN = "//img[@id='send1']";
    String CANCEL_BTN = "//img[@alt='Zrušit']";

    @Wait(value = MAIL_SUBJECT, by = Lookup.ID)
    @TypeInto(value = MAIL_SUBJECT, by = Lookup.ID)
    IbWriteNewMailPage typeMailSubject(String mailSubject);

    @Wait(value = MAIL_TOPIC_SELECT, by = Lookup.ID)
    @Select(value = MAIL_TOPIC_SELECT, by = Lookup.ID)
    IbWriteNewMailPage selectMailTopic(String mailTopic);

    @Wait(value = MESSAGE_FORM, by = Lookup.ID)
    @TypeInto(value = MESSAGE_FORM, by = Lookup.ID)
    IbWriteNewMailPage typeMailText(String message);

    @Wait(SEND_BTN)
    @Click(SEND_BTN)
    IbArrivedMailsPage clickOnSendMail();

}
