package com.example.pageobjects.pakistan;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

public class HomePage {
    public WebDriver driver;

    public HomePage(WebDriver driver) {
        this.driver = driver;
    }

    public WebElement aboutUsButtonLocator() {
        return driver.findElement(By.cssSelector("div.col-sm-3.text-center.box-about > a > img"));
    }

    public WebElement timeLineButtonLocator() {
        return driver.findElement(By.cssSelector("div.col-sm-3.text-center.box-timeline > a > img"));
    }

    public WebElement contactButtonLocator() {
        return driver.findElement(By.cssSelector("a:nth-child(2) > button"));
    }

    public WebElement featureLocator(Integer feature) {
        return driver.findElement(By.cssSelector("body > div.container-fluid > div > div:nth-child(" + feature + ")"));
    }

    public WebElement featureLearnMoreButtonLocator(String feature) {
        return driver.findElement(By.xpath(String.format("//a[@href='https://dev.baitussalam.org/%s']", feature)));
    }

    public WebElement bayanListLocator(String bayan) {
        return driver.findElement(By.xpath(String.format("(//h3[normalize-space()='%s'])", bayan)));
    }

    public WebElement publicationListLocator(String publication) {
        return driver.findElement(By.xpath(String.format("//span[normalize-space()='%s']", publication)));
    }

    public WebElement educationProjectListLocator(String educationProject) {
        return driver.findElement(By.xpath(String.format("//h5[normalize-space()='%s']", educationProject)));
    }

    public WebElement welfareProjectLocator(String bayan) {
        return driver.findElement(By.xpath(String.format("(//h3[normalize-space()='%s'])", bayan)));
    }

    public WebElement emailFieldForSubscription() {
        return driver.findElement(By.cssSelector("input[name='email']"));
    }

    public WebElement successMessage() {
        return driver.findElement(By.cssSelector("div[class='alert alert-success']"));
    }

    public WebElement socialMediaButton(String socialMedia) {
        return driver.findElement(By.cssSelector(String.format("i[class='fab fa-%s']", socialMedia)));
    }

    public WebElement contactNameField() {
        return driver.findElement(By.cssSelector("input[placeholder='Enter Name']"));
    }

    public WebElement contactEmailField() {
        return driver.findElement(By.cssSelector("input[placeholder='Enter Email']"));
    }

    public WebElement contactSubjectField() {
        return driver.findElement(By.cssSelector("input[placeholder='Enter Subject']"));
    }

    public WebElement contactPhoneField() {
        return driver.findElement(By.cssSelector("input[placeholder='Enter Phone']"));
    }

    public WebElement messageField() {
        return driver.findElement(By.cssSelector("textarea[placeholder='Enter Message']"));
    }

}
