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

namespace Atomx.Common.Entities
{
    /// <summary>
    /// 商品属性
    /// </summary>
    [Table("ProductAttributes")]
    public class ProductAttribute
    {
        /// <summary>
        /// 属性ID
        /// </summary>
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Key]
        public long Id { get; set; }

        /// <summary>
        /// 分类ID
        /// </summary>
        public long CategoryId { get; set; }

        /// <summary>
        /// 上级属性,用于规格属性做分组
        /// </summary>
        public long ParentId { get; set; }

        /// <summary>
        /// 属性名称
        /// </summary>
        [Column(TypeName = "varchar(50)")]

        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 必须填写重量
        /// </summary>
        public bool WeightIsRequired { get; set; } = false;

        /// <summary>
        /// 重量单位,1毫克mg，2克g,3千克kg,4吨t，5磅lb，6盎司oz
        /// </summary>
        public int WeightUnit { get; set; }

        /// <summary>
        /// 属性控件类型，1选项，0文本
        /// </summary>
        public int ControlType { get; set; }

        /// <summary>
        /// 使用属性的产品数量
        /// </summary>
        public int Count { get; set; }

        /// <summary>
        /// 展示排序
        /// </summary>
        public int DisplayOrder { get; set; }

        /// <summary>
        /// 是否是必须的属性
        /// </summary>
        public bool IsRequired { get; set; }

        /// <summary>
        /// 数据状态
        /// </summary>
        public int Status { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Column(TypeName = "timestamptz")]

        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        [Column(TypeName = "timestamptz")]
        public DateTime? UpdateTime { get; set; }
    }
}
