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

namespace RB_MES_API.Models
{
    /// <summary>
    /// 推送接口通用。只要用到FFormID的Cloud接口都可以使用
    /// </summary>
    public class FormIDType
    {
        /// <summary>
        /// 主键
        /// </summary>
        [Key]
        [DisplayName("内码")]
        public int FID { get; set; }
        /// <summary>
        /// 来源于FunctionList的FID
        /// </summary>
        [Required]
        [DisplayName("接口名称")]
        public int FFunctionID { get; set; }
        /// <summary>
        /// 控制器内的方法名
        /// </summary>
        [DisplayName("执行方法名")]
        [StringLength(80)]
        public string FActionName { get; set; } = string.Empty;
        /// <summary>
        /// 获取查询字段列表的关键字
        /// </summary>
        [DisplayName("查询类型")]
        [StringLength(80)]
        public string FDocType { get; set; } = string.Empty;
        /// <summary>
        /// 提供给CloudBillQuery的FFormID
        /// </summary>
        [DisplayName("对方数据表名")]
        [StringLength(80)]
        public string FDBName { get; set; } = string.Empty;
        /// <summary>
        /// 如果禁用，则无法访问FActionName
        /// </summary>
        [DisplayName("是否使用")]
        [DefaultValue(true)]
        public bool FUsing { get; set; }
        /// <summary>
        /// 如果禁用，则无法访问FActionName
        /// </summary>
        [DisplayName("是否定时查询")]
        [DefaultValue(true)]
        public bool FIsHostService { get; set; }
        /// <summary>
        /// 说明
        /// </summary>
        [DisplayName("接口描述")]
        [StringLength(255)]
        public string FDescription { get; set; } = string.Empty;
        /// <summary>
        /// 获取返回值SQL脚本，用于反查ERP
        /// </summary>
        [DisplayName("推单唯一标识字段名")]
        [StringLength(100)]
        public string FGuidColName { get; set; } = "";
        /// <summary>
        /// 获取返回值SQL脚本，用于反查ERP
        /// </summary>
        [DisplayName("获取返回值SQL脚本")]
        [StringLength(500)]
        public string FNeedBreakSQL { get; set; } = "";
        /// <summary>
        /// 外键
        /// </summary>
        [ForeignKey("FFunctionID")]
        public virtual FunctionList functions { get; set; }    //此处不能 = new FunctionList()，否则修改时也会多一张单据
    }
}
