using System.Collections.Generic;
using System.Reflection.Metadata.Ecma335;
using System.Text.Json.Serialization;
using Datory;
using Datory.Annotations;
using GxPress.Common.Tools;

namespace GxPress.Entity.WorkFlow
{
    /// <summary>
    /// 审批/抄送意见
    /// </summary>
    [DataTable("tede_flow_message")]
    public class FlowMessage : Datory.Entity
    {
        /// <summary>
        /// 流规则id
        /// </summary>
        [DataColumn]
        public int ProcessId { get; set; }

        /// <summary>
        /// 流id
        /// </summary>
        [DataColumn]
        public int FlowId { get; set; }

        /// <summary>
        /// 用户id
        /// </summary>
        [DataColumn]
        public int UserId { get; set; }

        /// <summary>
        /// 待办工作类型(TodoTypeConst)：ApproverCheck审核,CarbonCopy抄送
        /// </summary>
        [DataColumn]
        public string Type { get; set; }

        /// <summary>
        /// 审批/抄送意见
        /// </summary>
        [DataColumn]
        public string Message { get; set; }

        /// <summary>
        /// 附件列表
        /// </summary>
        [JsonIgnore]
        [DataColumn]
        private string FileIdCollection { get; set; }

        /// <summary>
        /// 附件列表
        /// </summary>
        public IEnumerable<int> FileIds
        {
            get => StringUtils.StringCollectionToIntList(FileIdCollection);
            set => FileIdCollection = StringUtils.ObjectCollectionToString(value);
        }
    }
}