using Microsoft.Office.Tools.Word;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AIProofread.core
{
    public class MessageActionEnum
    {
        public string Action { get; set; }
        public MessageActionEnum(string action)
        {
            this.Action = action;
        }

        /// <summary>
        /// 开始校对
        /// </summary>
        public static readonly MessageActionEnum StartProofread = new MessageActionEnum("start");


        /// <summary>
        /// 插件升级
        /// </summary>
        public static readonly MessageActionEnum Upgrade = new MessageActionEnum("upgrade");
        /// <summary>
        /// 清除所有校对内容
        /// </summary>
        public static readonly MessageActionEnum ClearTips = new MessageActionEnum("clear-tips");
        /// <summary>
        /// 打开插件
        /// </summary>
        public static readonly MessageActionEnum ShowSetting = new MessageActionEnum("show-setting");
        /// <summary>
        /// 打开(显示)词库管理
        /// </summary>
        public static readonly MessageActionEnum ShowLexicon = new MessageActionEnum("show-lexicon");
        /// <summary>
        /// 选中校对项
        /// </summary>
        public static readonly MessageActionEnum SelectProofreadItem = new MessageActionEnum("select-proofread");
        /// <summary>
        /// 禁用(隐藏)校对项
        /// </summary>
        public static readonly MessageActionEnum DisableProofreadItem = new MessageActionEnum("disabled-proofread");

        /// <summary>
        /// 注销登录
        /// </summary>
        public static readonly MessageActionEnum Logout = new MessageActionEnum("logout");
        /// <summary>
        /// 同步注销登录
        /// </summary>
        public static readonly MessageActionEnum AsyncLogout = new MessageActionEnum("async-logout");
        /// <summary>
        /// 同步登录成功
        /// </summary>
        public static readonly MessageActionEnum AsyncLoginSuccess = new MessageActionEnum("async-login-success");


    }
    public class MainPanelWebMessage
    {

        public static void Send(MessageActionEnum action, object data)
        {
            Globals.ThisAddIn.SendMessageToWeb(action.Action, data);
        }
        public static void Send(MessageActionEnum action)
        {
            Globals.ThisAddIn.SendMessageToWeb(action.Action, null);
        }

        public static void SelectProofreadItem(int proofreadItemId)
        {
            Globals.ThisAddIn.SendMessageToWeb(MessageActionEnum.SelectProofreadItem.Action, proofreadItemId);
        }
        public static void DisabledProofreadItem(List<int> proofreadItemIdList)
        {
            if (proofreadItemIdList.Count == 0) return;
            Globals.ThisAddIn.SendMessageToWeb(MessageActionEnum.DisableProofreadItem.Action, proofreadItemIdList);
        }

        public static void DisabledProofreadItem(int proofreadItemId)
        {
            DisabledProofreadItem(new List<int>() { proofreadItemId });
        }

    }
}
