using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace RB_MES_API.Models
{
    /// <summary>
    /// 动态类配置
    /// </summary>
    public class SelfClass
    {
        /// <summary>
        /// 主键
        /// </summary>
        [Key]
        public int FID { get; set; }
        /// <summary>
        /// SelectJoinID的主键
        /// </summary>
        [DisplayName("字段名")]
        public int FSID { get; set; }
        /// <summary>
        /// ForeignKey属性
        /// </summary>
        [DisplayName("外键")]
        [StringLength(80)]
        public string FForeignKey { get; set; } = string.Empty;
        /// <summary>
        /// Name属性
        /// </summary>
        [Required]
        [DisplayName("字段名")]
        [StringLength(80)]
        public string FFieldName { get; set; }= string.Empty;
        /// <summary>
        /// DataType属性
        /// </summary>
        [Required]
        [DisplayName("数据类型")]
        [StringLength(80)]
        public string FDbTypeName { get; set; }= string.Empty;
        /// <summary>
        /// DisplayName属性
        /// </summary>
        [DisplayName("显示名")]
        [StringLength(80)]
        public string FDisplayName { get; set; }= string.Empty;
        /// <summary>
        /// 是否需要必录校验，当为必录时，增加Required属性
        /// </summary>
        [DisplayName("是否必录控制")]
        [DefaultValue(true)]
        public bool FIsRequired { get; set; }
        /// <summary>
        /// 是否需要空值校验
        /// </summary>
        [DisplayName("允许为空")]
        [DefaultValue(true)]
        public bool FIsNull { get; set; }
        /// <summary>
        /// 根据字段来源不同，决定默认值的校验方式
        /// </summary>
        [DisplayName("默认值")]
        public string FDefaultValue { get; set; }=string.Empty;
        /// <summary>
        /// 外键
        /// </summary>
        [ForeignKey("FSID")]
        public SelectJoinID selectjoins { get; set; } = new SelectJoinID();
    }
}
