using Kivii.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Kivii.Domain.Contents
{
    [Api(Description = "重定向管理")]
    [Alias(Configs.TableNameRedirect)]
    public class Redirect : EntityWithMetadata, IEntityInAssemblyDb,
        IEntityHasCreator, IEntityHasUpdater
    {
        #region 关联信息
        //[InternalSetter]
        [DefaultEmptyGuid]
        public Guid BizKvid { get; set; }

        [ApiMember(Description = "业务流水号")]
        //[InternalSetter]
        [StringLength(200)]
        public string BizId { get; set; }

        [ApiMember(Description = "业务类型")]
        //[InternalSetter]
        [StringLength(100)]
        public string BizType { get; set; }
        #endregion

        #region 基本信息
        [ApiMember(Description = "内部编号,如果有必须要唯一")]
        [IgnoreUpdate, Unique]
        [StringLength(50), Required]
        public string InternalCode { get; set; }

        [ApiMember(Description = "标题,简述")]
        [StringLength(200), Required]
        public string Title { get; set; }

        [ApiMember(Description = "分类")]
        [StringLength(50), Default("")]
        public string Type { get; set; }

        [ApiMember(Description = "跳转地址")]
        [StringLength(500), Default("")]
        public string Url { get; set; }

        [ApiMember(Description = "模板地址,可以为空")]
        [StringLength(500), Default("")]
        public string TemplatePath { get; set; }

        [ApiMember(Description = "是否发布")]
        public bool IsPublish { get; set; }
        #endregion

        #region 文本 摘要 备注
        [ApiMember(Description = "摘要，最大500字")]
        [IgnoreUpdate]
        [StringLength(500), Default("")]
        public string Summary { get; set; }

        [ApiMember(Description = "备注，最大2000字")]
        [StringLength(2000), Default("")]
        public string Remark { get; set; }
        #endregion

        #region 统计信息
        [ApiMember(Description = "点击数")]
        [InternalSetter]
        [Default(0)]
        public int Hits { get; set; }
        #endregion

        #region 操作相关 Creator Updater Operator OperateTime 

        [ApiMember(Description = "操作日期")]
        [IgnoreUpdate]
        [Required]
        public DateTime OperateTime { get; set; }

        [ApiMember(Description = "创建人Kvid ")]
        [IgnoreUpdate]
        [CurrentMemberKvid]
        public Guid CreatorKvid { get; set; }

        [ApiMember(Description = "创建人")]
        [IgnoreUpdate]
        [StringLength(50), CurrentMemberName]
        public string CreatorName { get; set; }

        [ApiMember(Description = "更新人Kvid ")]
        [CurrentMemberKvid]
        public Guid UpdaterKvid { get; set; }

        [ApiMember(Description = "更新人")]
        [StringLength(50), CurrentMemberName]
        public string UpdaterName { get; set; }

        #endregion
    }
}
