package com.playwrightdemo.utils;
import com.playwrightdemo.utils.ConfigReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class ConfigReader {

     private static Properties prop;
    private static final String configFilePath="src/test/resources/config.properties";


    static {

        try {
            initConfigProperties();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }


    public static void initConfigProperties() throws IOException {

        prop=new Properties();
        prop.load(new FileInputStream(configFilePath));

    }

    public static String getBrowserProperty(){

        return prop.getProperty("browser");

    }

    public static boolean getHeadLessAttribute(){

        return Boolean.getBoolean(prop.getProperty("headlessAttribute"));

    }

    public static String getAppURL(){

        return prop.getProperty("URL");

    }

    public static String getAppUserName() {

        return prop.getProperty("username");
    }


    public static String getAppPassword() {

        return prop.getProperty("password");
    }

    public static String getEmailUserName() {

        return prop.getProperty("Email_UserName");
    }

    public static String getEmailPassword() {

        return prop.getProperty("Email_Password");
    }

    public static String getHostName(){

        return prop.getProperty("Email_SMTPHostName");

    }

    public static int getPortNumber(){

        return Integer.parseInt(prop.getProperty("Email_PortNumber"));
    }



}
