using Aitex.Core.WCF;
using System.Collections.Generic;

namespace MECF.Framework.Common.MultiProcess.ProcessCenter
{
    public class MultiProcessServiceClient : ServiceClientWrapper<IMultiProcessService>, IMultiProcessService
    {

        public MultiProcessServiceClient() : base("Client_IMultiProcessService", "MultiProcessService")
        {
            
        }
        public bool CanEnterProcessIdleNow(string sicMachineName, string pmName, string state, out string result)
        {
            bool r = false;
            string temp = "";
            Invoke(delegate (IMultiProcessService svc)
            {
                r = svc.CanEnterProcessIdleNow(sicMachineName, pmName, state, out temp);
            });
            result = temp;
            return r;
        }

        public bool CanEnterProcessNow(string sicMachineName, string pmName, string state, out string result)
        {
            bool r = false;
            string temp = "";
            Invoke(delegate (IMultiProcessService svc)
            {
                r = svc.CanEnterProcessNow(sicMachineName, pmName, state, out temp);
            });
            result = temp;
            return r;
        }

        public List<string> QueryAllProcessInformation()
        {
            List<string> list = new();
            Invoke(delegate (IMultiProcessService svc)
            {
                list = svc.QueryAllProcessInformation();
            });
            return list;
        }

        public string QueryMyProcessInformation(string sicMachineName, string pmName)
        {
            string r = "";
            Invoke(delegate (IMultiProcessService svc)
            {
                r = svc.QueryMyProcessInformation(sicMachineName, pmName);

            });
            return r;
        }

        public bool UpdateChamberState(string sicMachineName,string pmName, string state, string heatbase)
        {
            bool r = false;
            Invoke(delegate (IMultiProcessService svc)
            {
                r = svc.UpdateChamberState(sicMachineName, pmName, state, heatbase);
            });
            return r;
        }
    }
}
