using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
using TEAMModelOS.SDK.Models.Cosmos.Common;

namespace TEAMModelOS.SDK.Models.Cosmos
{
    /// <summary>
    /// 课纲-我喜欢的，我的收藏
    /// </summary>
    public class Favorite : CosmosEntity
    {
        public Favorite() {
            pk = "Favorite";
            ttl = -1;
            //code ="Favorite-tmdid"
        }
        public SyllabusTree node { get; set; }
        /// <summary>
        /// 名称 默认选中节点名称，或者自定义输入名称
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public long createTime { get; set; }
        /// <summary>
        /// 引用来源课纲id
        /// </summary>
        [Required(ErrorMessage = "引用来源课纲id 必须设置")]
        public string fromId { get; set; }
        /// <summary>
        /// 引用来源 课纲Code 分区键
        /// </summary>
        [Required(ErrorMessage = "引用来源课纲code 必须设置")]
        public string fromCode { get; set; }
    }

    /*
     {
        "id":"课纲册别id",
        "code":"Share-接收者tmdid",
        "issuer":"分享者tmdid",
        "createTime":分享时间,
        "scode":"引用来源课纲册别code",
        "scope":"school/private",
        "school":"hbcn",
        "issuer"："颁发权限的id"
    }
     */
    /// <summary>
    /// 主动分享给谁， 分享功能只会发生在个人课纲中
    /// </summary>
    public class Share : CosmosEntity {
        public Share(){
            pk = "Share";
        }

        public string scode { get; set; }
        /// <summary>
        /// 权限颁发者
        /// </summary>
        public string issuer { get; set; }
        public long  createTime { get; set; }
        /// <summary>
        /// 学校编码或教师tmdid
        /// </summary>
        [Required(ErrorMessage = "school 必须设置")]
        public string school { get; set; }
        /// <summary>
        /// school|private
        /// </summary>
        [Required(ErrorMessage = "scope 必须设置")]
        public string scope { get; set; }
        /// <summary>
        /// 共编
        /// </summary>
        public bool coedit { get; set; }
        /// <summary>
        /// 分享
        /// </summary>
        public bool share { get; set; }
        /// <summary>
        /// 课纲名称
        /// </summary>
        public string sname { get; set; }
    }
         
    /// <summary>
    /// 主动分享给谁,当接收者接收并完成相关资源复制后则删除本条数据。
    /// </summary>
    public class ShareData
    {
        /// <summary>
        /// 学校编码
        /// </summary>
        [Required(ErrorMessage = "school 必须设置")]
        public string school { get; set; }
        /// <summary>
        /// school|private
        /// </summary>
        [Required(ErrorMessage = "scope 必须设置")]
        public string scope { get; set; }
        /// <summary>
        /// add/edit/del
        /// </summary>
        [Required(ErrorMessage = "opt 必须设置")]
        public string opt { get; set; }

        [Required(ErrorMessage = "tmdid 必须设置")]
        public string tmdid { get; set; }
        /// <summary>
        /// tmdname
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 课纲册别的id
        /// </summary>
        [Required(ErrorMessage = "sid 必须设置")]
        public string sid { get; set; }
        /// <summary>
        /// 课纲册别的分区键
        /// </summary>
        [Required(ErrorMessage = "socde 必须设置")]
        public string scode { get; set; }
        /// <summary>
        /// 课纲册别的名称
        /// </summary>
        [Required(ErrorMessage = "sname 必须设置")]
        public string sname { get; set; }
        /// <summary>
        /// 共编权限
        /// </summary>
        public bool coedit { get; set; } = false;
        /// <summary>
        /// 分享权限
        /// </summary>
        public bool share { get; set; } = false;
        /// <summary>
        /// 分享的节点 all  或者節點id
        /// </summary>
        public List<string> snodes { get; set; } = new List<string>();
        /// <summary>
        /// 共编 分享权限颁发者
        /// </summary>
        [Required(ErrorMessage = "issuer 必须设置")]
        public string issuer { get; set; }
    }
}
