using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace Tianyi.DingtalkRobotKit
{
    public class WholeCardMessage : MessageBase
    {
        public WholeCardMessage(WholeCardOption option) : base()
        {
            this.actionCard = option;
        }

        public WholeCardMessage(WholeCardOption option, at linkAt) : base()
        {
            this.actionCard = option;
            this.at = linkAt;
        }

        public WholeCardOption actionCard { get; set; }

        /// <summary>
        /// 消息类型
        /// </summary>
        public override string msgtype { get => "actionCard"; }

        /// <summary>
        /// 转换为json字符串
        /// </summary>
        public override string ToJson()
        {
            var meaasge = new
            {
                msgtype = this.msgtype,
                actionCard = this.actionCard,
                at = this.at
            };

            string messageJson = JsonConvert.SerializeObject(meaasge);

            return messageJson;
        }
    }
}