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

namespace FWHandler
{
    public class TextBoxHandler
    {
        IFWTextBoxs controller;
        public TextBoxHandler(IFWTextBoxs controller)
        {
            this.controller = controller;
        }

        private string text;
        public string Text
        {
            get
            {
                text = controller.ReadFromTextBox();
                return text;
            }
            set
            {
                text = value;
                controller.InsertToTextBox(text);
            }
        }
     
        public TextBoxHandler Click(string name, int repeatingTime = 0)
        {
            controller.TextBoxClickBy(name, repeatingTime);
            return new TextBoxHandler(controller);
        }
        public TextBoxHandler DoubleClick(string name, int repeatingTime = 0)
        {
            controller.TextBoxDoubleClickBy(name, repeatingTime);
            return new TextBoxHandler(controller);
        }

        public TextBoxHandler ClickByName(string name, int repeatingTime = 0)
        {
            controller.TextBoxClickByName(name, repeatingTime);
            return new TextBoxHandler(controller);
        }

        public TextBoxHandler ClickByAutomationId(string name, int repeatingTime = 0)
        {
            controller.TextBoxClickByAutomationID(name, repeatingTime);
            return new TextBoxHandler(controller);
        }

        public TextBoxHandler Find(string name, int repeatingTime = 0)
        {
            controller.TextBoxFind(name, repeatingTime);
            return new TextBoxHandler(controller);
        }
        public TextBoxHandler Find(int id)
        {
            controller.TextBoxFindBy(id);
            return new TextBoxHandler(controller);
        }

        public bool IsVisible(string value, int repeatingTime = 0)
        {
            if ((controller.TextBoxIsVisible(value, repeatingTime)) == true)
            {
                return true;
            }
            return false;
        }
        public bool Exist(string value, int repeatingTime = 0)
        {
            if ((controller.TextBoxExist(value, repeatingTime)) == true)
            {
                return true;
            }
            return false;
        }

    }
}
