//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.5448
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Pluto.RelayServer {
    using System;
    using RemObjects.SDK;
    using RemObjects.SDK.Types;
    using System.Collections.Generic;
    
    [RemObjects.SDK.Remotable()]
    [System.Reflection.ObfuscationAttribute(Exclude=true)]
    public enum ActionFetch : int {
        CustomQuery = 0,
        Patient = 1,
        Appointment = 2,
    }
    [RemObjects.SDK.EventSink(Name="DataServerCallback", InvokerClass=typeof(DataServerCallback_EventSinkInvoker))]
    [System.Reflection.ObfuscationAttribute(Exclude=true)]
    public interface IDataServerCallback : RemObjects.SDK.IROEventSink {
        void Action_Add(string SessionID, ActionFetch actionType, System.Xml.XmlNode actionParams);
        void Action_Update(string SessionID, ActionFetch actionType, System.Xml.XmlNode actionParams);
        void Action_Delete(string SessionID, ActionFetch actionType, System.Xml.XmlNode actionParams);
        void Fetch(string SessionID, ActionFetch fetchType, System.Xml.XmlNode fetchParams);
    }
    [System.Reflection.ObfuscationAttribute(Exclude=true)]
    public class DataServerCallback_EventSinkInvoker : RemObjects.SDK.EventSinkInvoker {
        [System.Reflection.ObfuscationAttribute(Exclude=true)]
        public static void Invoke_Action_Add(RemObjects.SDK.IROEventSinkHandlers @__Handlers, RemObjects.SDK.IMessage @__Message) {
            RemObjects.SDK.ObjectDisposer @__ObjectDisposer = new RemObjects.SDK.ObjectDisposer(2);
            try {
                string SessionID = @__Message.ReadAnsiString("SessionID");
                ActionFetch actionType = ((ActionFetch)(@__Message.Read("actionType", typeof(ActionFetch), RemObjects.SDK.StreamingFormat.Default)));
                System.Xml.XmlNode actionParams = @__Message.ReadXml("actionParams");
                @__ObjectDisposer.Add(actionType);
                @__ObjectDisposer.Add(actionParams);
                for (int @__i = 0; (@__i < @__Handlers.Count); @__i = (@__i + 1)) {
                    ((IDataServerCallback)(@__Handlers[@__i])).Action_Add(SessionID, actionType, actionParams);
                }
            }
            finally {
                @__ObjectDisposer.Dispose();
            }
        }
        [System.Reflection.ObfuscationAttribute(Exclude=true)]
        public static void Invoke_Action_Update(RemObjects.SDK.IROEventSinkHandlers @__Handlers, RemObjects.SDK.IMessage @__Message) {
            RemObjects.SDK.ObjectDisposer @__ObjectDisposer = new RemObjects.SDK.ObjectDisposer(2);
            try {
                string SessionID = @__Message.ReadAnsiString("SessionID");
                ActionFetch actionType = ((ActionFetch)(@__Message.Read("actionType", typeof(ActionFetch), RemObjects.SDK.StreamingFormat.Default)));
                System.Xml.XmlNode actionParams = @__Message.ReadXml("actionParams");
                @__ObjectDisposer.Add(actionType);
                @__ObjectDisposer.Add(actionParams);
                for (int @__i = 0; (@__i < @__Handlers.Count); @__i = (@__i + 1)) {
                    ((IDataServerCallback)(@__Handlers[@__i])).Action_Update(SessionID, actionType, actionParams);
                }
            }
            finally {
                @__ObjectDisposer.Dispose();
            }
        }
        [System.Reflection.ObfuscationAttribute(Exclude=true)]
        public static void Invoke_Action_Delete(RemObjects.SDK.IROEventSinkHandlers @__Handlers, RemObjects.SDK.IMessage @__Message) {
            RemObjects.SDK.ObjectDisposer @__ObjectDisposer = new RemObjects.SDK.ObjectDisposer(2);
            try {
                string SessionID = @__Message.ReadAnsiString("SessionID");
                ActionFetch actionType = ((ActionFetch)(@__Message.Read("actionType", typeof(ActionFetch), RemObjects.SDK.StreamingFormat.Default)));
                System.Xml.XmlNode actionParams = @__Message.ReadXml("actionParams");
                @__ObjectDisposer.Add(actionType);
                @__ObjectDisposer.Add(actionParams);
                for (int @__i = 0; (@__i < @__Handlers.Count); @__i = (@__i + 1)) {
                    ((IDataServerCallback)(@__Handlers[@__i])).Action_Delete(SessionID, actionType, actionParams);
                }
            }
            finally {
                @__ObjectDisposer.Dispose();
            }
        }
        [System.Reflection.ObfuscationAttribute(Exclude=true)]
        public static void Invoke_Fetch(RemObjects.SDK.IROEventSinkHandlers @__Handlers, RemObjects.SDK.IMessage @__Message) {
            RemObjects.SDK.ObjectDisposer @__ObjectDisposer = new RemObjects.SDK.ObjectDisposer(2);
            try {
                string SessionID = @__Message.ReadAnsiString("SessionID");
                ActionFetch fetchType = ((ActionFetch)(@__Message.Read("fetchType", typeof(ActionFetch), RemObjects.SDK.StreamingFormat.Default)));
                System.Xml.XmlNode fetchParams = @__Message.ReadXml("fetchParams");
                @__ObjectDisposer.Add(fetchType);
                @__ObjectDisposer.Add(fetchParams);
                for (int @__i = 0; (@__i < @__Handlers.Count); @__i = (@__i + 1)) {
                    ((IDataServerCallback)(@__Handlers[@__i])).Fetch(SessionID, fetchType, fetchParams);
                }
            }
            finally {
                @__ObjectDisposer.Dispose();
            }
        }
    }
    public interface IRelayServerResponse : RemObjects.SDK.IROService {
        void Action_Response(string SessionID, ActionFetch actionType, bool Success, string ErrorString);
        void Fetch_Response(string SessionID, ActionFetch fetchType, bool Success, string ErrorString, System.Xml.XmlNode Response);
    }
    public partial class RelayServerResponse_Proxy : RemObjects.SDK.Proxy, IRelayServerResponse {
        public RelayServerResponse_Proxy(RemObjects.SDK.IMessage aMessage, RemObjects.SDK.IClientChannel aClientChannel) : 
                base(aMessage, aClientChannel) {
        }
        public RelayServerResponse_Proxy(RemObjects.SDK.IMessage aMessage, RemObjects.SDK.IClientChannel aClientChannel, string aOverrideInterfaceName) : 
                base(aMessage, aClientChannel, aOverrideInterfaceName) {
        }
        public RelayServerResponse_Proxy(RemObjects.SDK.IRemoteService aRemoteService) : 
                base(aRemoteService) {
        }
        public RelayServerResponse_Proxy(RemObjects.SDK.IRemoteService aRemoteService, string aOverrideInterfaceName) : 
                base(aRemoteService, aOverrideInterfaceName) {
        }
        protected override string @__GetInterfaceName() {
            return "RelayServerResponse";
        }
        public virtual void Action_Response(string SessionID, ActionFetch actionType, bool Success, string ErrorString) {
            RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
            @__LocalMessage.InitializeRequestMessage(@__ClientChannel, "RelayServer", @__GetActiveInterfaceName(), "Action_Response");
            @__LocalMessage.WriteAnsiString("SessionID", SessionID);
            @__LocalMessage.Write("actionType", actionType, typeof(ActionFetch), RemObjects.SDK.StreamingFormat.Default);
            @__LocalMessage.WriteBoolean("Success", Success);
            @__LocalMessage.WriteAnsiString("ErrorString", ErrorString);
            @__LocalMessage.FinalizeMessage();
            @__ClientChannel.Dispatch(@__LocalMessage);
            @__LocalMessage.Clear();
        }
        public virtual void Fetch_Response(string SessionID, ActionFetch fetchType, bool Success, string ErrorString, System.Xml.XmlNode Response) {
            RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
            @__LocalMessage.InitializeRequestMessage(@__ClientChannel, "RelayServer", @__GetActiveInterfaceName(), "Fetch_Response");
            @__LocalMessage.WriteAnsiString("SessionID", SessionID);
            @__LocalMessage.Write("fetchType", fetchType, typeof(ActionFetch), RemObjects.SDK.StreamingFormat.Default);
            @__LocalMessage.WriteBoolean("Success", Success);
            @__LocalMessage.WriteAnsiString("ErrorString", ErrorString);
            @__LocalMessage.WriteXml("Response", Response);
            @__LocalMessage.FinalizeMessage();
            @__ClientChannel.Dispatch(@__LocalMessage);
            @__LocalMessage.Clear();
        }
    }
    public class CoRelayServerResponse {
        public static IRelayServerResponse Create(RemObjects.SDK.IMessage aMessage, RemObjects.SDK.IClientChannel aClientChannel) {
            return new RelayServerResponse_Proxy(aMessage, aClientChannel);
        }
        public static IRelayServerResponse Create(RemObjects.SDK.IRemoteService aRemoteService) {
            return new RelayServerResponse_Proxy(aRemoteService);
        }
    }
    public interface IRelayServerResponse_Async : RemObjects.SDK.IROService_Async {
        System.IAsyncResult BeginAction_Response(string SessionID, ActionFetch actionType, bool Success, string ErrorString, System.AsyncCallback @__Callback, object @__UserData);
        void EndAction_Response(System.IAsyncResult @__AsyncResult);
        System.IAsyncResult BeginFetch_Response(string SessionID, ActionFetch fetchType, bool Success, string ErrorString, System.Xml.XmlNode Response, System.AsyncCallback @__Callback, object @__UserData);
        void EndFetch_Response(System.IAsyncResult @__AsyncResult);
    }
    public partial class RelayServerResponse_AsyncProxy : RemObjects.SDK.AsyncProxy, IRelayServerResponse_Async {
        public RelayServerResponse_AsyncProxy(RemObjects.SDK.IMessage aMessage, RemObjects.SDK.IClientChannel aClientChannel) : 
                base(aMessage, aClientChannel) {
        }
        public RelayServerResponse_AsyncProxy(RemObjects.SDK.IMessage aMessage, RemObjects.SDK.IClientChannel aClientChannel, string aOverrideInterfaceName) : 
                base(aMessage, aClientChannel, aOverrideInterfaceName) {
        }
        public RelayServerResponse_AsyncProxy(RemObjects.SDK.IRemoteService aRemoteService) : 
                base(aRemoteService) {
        }
        public RelayServerResponse_AsyncProxy(RemObjects.SDK.IRemoteService aRemoteService, string aOverrideInterfaceName) : 
                base(aRemoteService, aOverrideInterfaceName) {
        }
        protected override string @__GetInterfaceName() {
            return "RelayServerResponse";
        }
        public virtual System.IAsyncResult BeginAction_Response(string SessionID, ActionFetch actionType, bool Success, string ErrorString, System.AsyncCallback @__Callback, object @__UserData) {
            RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
            @__LocalMessage.InitializeRequestMessage(@__ClientChannel, "RelayServer", @__GetActiveInterfaceName(), "Action_Response");
            @__LocalMessage.WriteAnsiString("SessionID", SessionID);
            @__LocalMessage.Write("actionType", actionType, typeof(ActionFetch), RemObjects.SDK.StreamingFormat.Default);
            @__LocalMessage.WriteBoolean("Success", Success);
            @__LocalMessage.WriteAnsiString("ErrorString", ErrorString);
            @__LocalMessage.FinalizeMessage();
            return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
        }
        public virtual void EndAction_Response(System.IAsyncResult @__AsyncResult) {
            RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
            @__LocalMessage.Clear();
        }
        public virtual System.IAsyncResult BeginFetch_Response(string SessionID, ActionFetch fetchType, bool Success, string ErrorString, System.Xml.XmlNode Response, System.AsyncCallback @__Callback, object @__UserData) {
            RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
            @__LocalMessage.InitializeRequestMessage(@__ClientChannel, "RelayServer", @__GetActiveInterfaceName(), "Fetch_Response");
            @__LocalMessage.WriteAnsiString("SessionID", SessionID);
            @__LocalMessage.Write("fetchType", fetchType, typeof(ActionFetch), RemObjects.SDK.StreamingFormat.Default);
            @__LocalMessage.WriteBoolean("Success", Success);
            @__LocalMessage.WriteAnsiString("ErrorString", ErrorString);
            @__LocalMessage.WriteXml("Response", Response);
            @__LocalMessage.FinalizeMessage();
            return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
        }
        public virtual void EndFetch_Response(System.IAsyncResult @__AsyncResult) {
            RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
            @__LocalMessage.Clear();
        }
    }
}
