using Aitex.Core.RT.Device;
using Aitex.Sorter.Common;
using MECF.Framework.Common.SubstrateTrackings;

namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners
{
    public class AlignerBase : BaseDevice, IDevice
    {
        public bool IsBusy
        {
            get { return true; }
        }

        public bool IsError { get; set; }



        public AlignerBase(string module, string name, string display, string deviceId)
            : base(module, name, display, deviceId)
        {

        }

        public virtual bool Initialize()
        {
            WaferManager.Instance.SubscribeLocation(Module, 1);

            return true;
        }  

        public virtual void Terminate()
        {
        }


        public virtual void Reset()
        {
            IsError = false;
        }


        public virtual bool Home(out string reason)
        {
            reason = string.Empty;
            return true;
        }

        public virtual bool Clear(out string reason)
        {
            reason = string.Empty;
            return true;
        }

        public virtual bool Grip(Hand hand, out string reason)
        {
            reason = string.Empty;
            return true;
        }

        public virtual bool Release(Hand hand, out string reason)
        {
            reason = string.Empty;
            return true;
        }

        public virtual bool LiftUp(out string reason)
        {
            reason = string.Empty;
            return true;
        }

        public virtual bool LiftDown(out string reason)
        {
            reason = string.Empty;
            return true;
        }

        public virtual bool Stop(out string reason)
        {
            reason = string.Empty;
            return true;
        }

        public virtual bool Align(double angle, out string reason)
        {
            reason = string.Empty;
            return true;
        }


        public virtual bool QueryState(out string reason)
        {
            reason = string.Empty;
            return true;
        }

        public virtual void OnError()
        {
            IsError = true;
        }

        public virtual bool QueryWaferPresence(out string reason)
        {
            reason = string.Empty;

            return true;
        }

        public virtual void OnAligned()
        {

        }

    }
}
