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

namespace Atomx.Common.Entities
{
    /// <summary>
    /// 产品库存记录
    /// </summary>
    [Table("ProductInventoryLogs")]
    public class ProductInventoryLog
    {
        /// <summary>
        /// 数据ID
        /// </summary>
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Key]
        public long Id { get; set; }

        /// <summary>
        /// 产生动作的用户ID
        /// </summary>
        public long? Operator { get; set; }

        /// <summary>
        /// 类型,0入库，1出库，初始
        /// </summary>
        public int? Type { get; set; }

        /// <summary>
        /// 产品ID
        /// </summary>
        public long ProductId { get; set; }

        /// <summary>
        /// 归属买家店铺或货仓
        /// </summary>
        public long StoreId { get; set; }

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

        /// <summary>
        /// 供应制造商ID
        /// </summary>
        public long ManufacturerId { get; set; }

        /// <summary>
        /// 仓库ID
        /// </summary>
        public long WarehouseId { get; set; }

        /// <summary>
        /// 产品属性组合ID
        /// </summary>
        public long ProductAttributeCombinationId { get; set; }

        /// <summary>
        /// 订单ID
        /// </summary>
        public long OrderId { get; set; }

        /// <summary>
        /// 操作数量
        /// </summary>
        public int ChangeAmount { get; set; }

        /// <summary>
        /// 重量
        /// </summary>
        [Column(TypeName = "decimal(18,4)")]
        public decimal Weight { get; set; }

        /// <summary>
        /// 操作之前库存
        /// </summary>
        public int BeforeStock { get; set; }

        /// <summary>
        /// 操作之后库存
        /// </summary>
        public int AfterStock { 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; }
    }
}
