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

namespace Atomx.Common.Entities
{
    /// <summary>
    /// 原料详细记录，采购入库、使用出库、借调、归还、盘点校对
    /// </summary>
    [Table("MaterialRecords")]
    public class MaterialRecord
    {
        /// <summary>
        /// 数据ID
        /// </summary>
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Key]
        public long Id { get; set; }

        /// <summary>
        /// 操作类型，采购入库、使用出库、借调出库、归还入库、盘点校对
        /// </summary>
        public int Type { get; set; }

        /// <summary>
        /// 原料Id
        /// </summary>
        public long MaterialId { get; set; }

        /// <summary>
        /// 归属原料批次ID
        /// </summary>
        public long MaterialBatchId { get; set; }

        /// <summary>
        /// 归属公司id
        /// </summary>
        public long CorporationId { get; set; }

        /// <summary>
        /// 数据店铺网点id
        /// </summary>
        public long StoreId { get; set; }

        /// <summary>
        /// 操作用户ID
        /// </summary>
        public long UserId { get; set; }
        
        /// <summary>
        /// 原料价格
        /// </summary>
        public decimal Price { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public decimal Quantity { get; set; }

        /// <summary>
        /// 使用原料产生的费用
        /// </summary>
        public decimal Expenses { get; set; }

        /// <summary>
        /// 标记
        /// </summary>
        public int Mark { get; set; }

        /// <summary>
        /// 备注说明
        /// </summary>
        [Column(TypeName = "varchar(255)")]
        public string Note { get; set; } = string.Empty;

        /// <summary>
        /// 注册数据创建时间
        /// </summary>
        [Column(TypeName = "timestamptz")]
        public DateTime CreateTime { get; set; } = DateTime.UtcNow;
    }
}
