using System;
using NetWorkMessage;
using Server.Core;

namespace ActorCore
{
    /// <summary>
    /// IActor
    /// </summary>
    public interface IActor : IDisposable
    {
        ActorId ActorId
        {
            get;
        }

        /// <summary>
        /// 是否被Manager管理
        /// </summary>
        bool IsRegister
        {
            get;
            set;
        }

        bool IsDisposed
        {
            get;
        }

        SchedulerType SchedulerType
        {
            get;
        }
        
        /// <summary>
        /// 由ActorManager管理，其他地方不可以设置
        /// </summary>
        int Id
        {
            get;
        }

        /// <summary>
        /// 线程同步上下文
        /// </summary>
        ThreadSynchronizationContext ThreadSynchronizationContext
        {
            get;
        }

        void RegisterHandle();

        void IUpdate();

        void ILateUpdate();
        
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="actorId"></param>
        /// <param name="message"></param>
        void Send(ActorId actorId, IMessage message);
    }
}