using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace TEAMModelOS.SDK.Models
{
    /*
     {
        "id":"课纲册别id",
        "code":"Share-接收者tmdid",
        "issuer":"分享者tmdid",
        "createTime":分享时间,
        "scode":"引用来源课纲册别code",
        "scope":"school/private",
        "school":"hbcn",
        "issuer"："颁发权限的id"
    }
     */
    /// <summary>
    /// 主动分享给谁， 分享功能只会发生在个人课纲中
    /// </summary>
    public class Share : CosmosEntity
    {
        /// <summary>
        /// id 为章节id, code为Share-tmdid
        /// </summary>
        public Share()
        {
            pk = "Share";
        }
        /// <summary>
        /// 权限颁发者
        /// </summary>
        public string issuer { get; set; }
        public string issuerName { 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>
        /// 册别id
        /// </summary>
        public string volumeId { get; set; }
        /// <summary>
        /// 课纲章节的name
        /// </summary>
        [Required(ErrorMessage = "syllabusName 必须设置")]
        public string syllabusName { get; set; }
        /// <summary>
        /// 册别名称
        /// </summary>
        public string volumeName { get; set; }
       
        /// <summary>
        /// 分享  type=coedit共编,share分享
        /// </summary>
        public string type { get; set; }
        /// <summary>
        /// 是否同意
        /// </summary>
        public int agree { get; set; } = 0;
    }
    /// <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 List<ShareTmd> tmdInfo { get; set; } = new List<ShareTmd>();
      
        /// <summary>
        /// 课纲章节的id
        /// </summary>
        [Required(ErrorMessage = "syllabusId 必须设置")]
        public string syllabusId { get; set; }
        /// <summary>
        /// 课纲章节的name
        /// </summary>
        [Required(ErrorMessage = "syllabusName 必须设置")]
        public string syllabusName { get; set; }
        /// <summary>
        /// 册别名称
        /// </summary>
        public string volumeName { get; set; }
        /// <summary>
        /// 册别id
        /// </summary>
        public string volumeId { get; set; }
        /// <summary>
        /// 共编 分享权限颁发者
        /// </summary>
        [Required(ErrorMessage = "issuer 必须设置")]
        public string issuer { get; set; }
        public string issuerName { get; set; }

        /// <summary>
        /// 分享  type=coedit共编,share分享
        /// </summary>
        public string type { get; set; }
        /// <summary>
        /// 是否同意
        /// </summary>
        public int agree { get; set; } = 0;
    }
    public class ShareTmd
    {
        public string tmdid { get; set; }
        public string tmdname { get; set; }
        public string picture { get; set; }
    }
}
