using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FWHandler
{
   public class WindowHandler
    {
        IFWWindows controller;
        public WindowHandler(IFWWindows controller)
        {
            this.controller = controller;
        }

        public WindowHandler Find(string name, int repeatingTime = 0)
        {
            controller.FindElementBy(name, repeatingTime);
            return new WindowHandler(controller);
        }
        public WindowHandler FindChildrens(string name, int repeatingTime = 0)
        {
            controller.FindAllChildrenBy(name, repeatingTime);
            return new WindowHandler(controller);
        }
        public WindowHandler FindDescendants(string name, int repeatingTime = 0)
        {
            controller.FindAllDescendentsBy(name, repeatingTime);
            return new WindowHandler(controller);
        }
        public WindowHandler SelectSpecificId(int id)
        {
            controller.SelectSpecificId(id);
            return new WindowHandler(controller);
        }
        public WindowHandler Click(string name,int id, int repeatingTime = 0)
        {
            controller.ElementClickBy(name, id, repeatingTime);
            return new WindowHandler(controller);
        }

        public WindowHandler Find(string name, int id, int repeatingTime = 0)
        {
            controller.ElementFindBy(name, id, repeatingTime = 0);
            return new WindowHandler(controller);

        }
        public WindowHandler DoubleClick(string name, int id, int repeatingTime = 0)
        {
            controller.ElementDoubleClickBy(name, id, repeatingTime);
            return new WindowHandler(controller);
        }
        public WindowHandler RightClick(string name, int id, int repeatingTime = 0)
        {
            controller.ElementRightClickBy(name, id, repeatingTime);
            return new WindowHandler(controller);
        }   

        public bool ElementExists(string value, int repeatingTime = 0)
        {
            if((controller.ElementExist(value, repeatingTime)) == true)
            {
                return true;
            }
            return false;
        }

        public bool ElementIsVisible(string value, int repeatingTime = 0)
        {
            if (controller.ElementIsVisible(value, repeatingTime) == true)
            {
                return true;
            }
            else return false;
        }
        public bool ElementIsVisible(string value,int id, int repeatingTime = 0)
        {
            if (controller.ElementIsVisible(value,id, repeatingTime) == true)
            {
                return true;
            }
            else return false;
        }
        public string ElementGetName(string value, int repeatingTime = 0)
        {
            return controller.GetElementName(value, repeatingTime);
        }
        public string ElementGetName(string value,int id, int repeatingTime = 0)
        {
            return controller.GetElementName(value,id, repeatingTime);
        }

        public string GetWindowName(int timing = 0)
        {
            return controller.GetWindowName(timing);
        }
        public double GetWidth()
        {
            return controller.GetWidth();
        }
        public double GetHeight()
        {
            return controller.GetHeight();
        }
        public void Maximize()
        {
            controller.WindowMaximize();
        }
        public void Minimaze()
        {
            controller.WindowMinimaze();
        }

        public ButtonHandler Button { get; } = new ButtonHandler(FlaUIHandler.Instance);
        public CheckBoxHandler CheckBox { get; } = new CheckBoxHandler(FlaUIHandler.Instance);
        public TextBoxHandler TextBox { get; } = new TextBoxHandler(FlaUIHandler.Instance);
        public LabelHandler Label { get; } = new LabelHandler(FlaUIHandler.Instance);
        public RadioButtonHandler RadioButton { get; } = new RadioButtonHandler(FlaUIHandler.Instance);
        public ListItemHandler ListItem { get; } = new ListItemHandler(FlaUIHandler.Instance);
        public TreeItemHandler TreeItem { get; } = new TreeItemHandler(FlaUIHandler.Instance);




        // public ButtonHandler ButtonHandler { get; set; }
    }
}
