package com.example.stepdefinations.pakistan;

import com.example.pageobjects.pakistan.PublicationPage;
import com.example.utils.TextContextSetup;
import io.cucumber.java.en.When;

public class PublicationPageSteps {
    TextContextSetup textContextSetup;

    public PublicationPageSteps(TextContextSetup textContextSetup) {
        this.textContextSetup = textContextSetup;
    }

    @When("I select header {string} on publication page")
    public void iShouldSelectItemFromDropDownHeaderTitle(String header) throws InterruptedException {
        PublicationPage publicationPage = textContextSetup.pagesObject.getPublicationPage();
    Thread.sleep(300);
        publicationPage.pageHeader(header).click();
    }

    @When("I select {string} Publication Type on Subscribe for our publications on publication page")
    public void iShouldSelectPublicationType(String publicationType) throws InterruptedException {
        PublicationPage publicationPage = textContextSetup.pagesObject.getPublicationPage();
      Thread.sleep(300);
        publicationPage.publicationType(publicationType);
    }

    @When("I enter email {string} on Subscribe for our publication modal")
    public void iEnterEmailOnSubscribeForPublicationModal(String email)  {
        PublicationPage publicationPage = textContextSetup.pagesObject.getPublicationPage();
        publicationPage.email().sendKeys(email);
    }

    @When("I enter {string} in Search field in order to search on publication page")
    public void iSearchFromSearchBoxForPublicationPage(String searchItem)  {
        PublicationPage publicationPage = textContextSetup.pagesObject.getPublicationPage();
        publicationPage.searchFieldLocator().sendKeys(searchItem);
        publicationPage.searchButton().click();
    }

}
