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

namespace Atomx.Common.Entities
{
    /// <summary>
    /// 
    /// </summary>
    [Table("Products")]
    public class Product
    {
        /// <summary>
        /// 产品ID
        /// </summary>
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Key]
        public long Id { get; set; }

        /// <summary>
        /// 发布的企业用户ID
        /// </summary>

        public long CorporationStaffId { get; set; }

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

        /// <summary>
        /// 卖家店铺ID
        /// </summary>
        public long StoreId { get; set; }

        /// <summary>
        /// 产品类型ID
        /// </summary>
        public long ProductTypeId { get; set; }

        /// <summary>
        /// 分类路径
        /// </summary>
        [Column(TypeName = "varchar(200)")]
        public string? CategoryPath { get; set; } = string.Empty;

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

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

        /// <summary>
        /// 产品名称
        /// </summary>
        [Column(TypeName = "varchar(255)")]
        public string Title { get; set; } = string.Empty;

        /// <summary>
        /// 产品唯一编码
        /// </summary>
        [Column(TypeName = "varchar(20)")]
        public string? SIN { get; set; } = string.Empty;

        /// <summary>
        /// 封面图片
        /// </summary>
        [Column(TypeName = "varchar(256)")]
        public string? Image { get; set; } = string.Empty;

        /// <summary>
        /// 产品图片，JSON
        /// </summary>
        [Column(TypeName = "text")]
        public string? Photos { get; set; } = string.Empty;

        /// <summary>
        /// 产品卖点
        /// </summary>
        [Column(TypeName = "varchar(255)")]
        public string? Feature { get; set; } = string.Empty;

        /// <summary>
        /// 产品简介
        /// </summary>
        [Column(TypeName = "varchar(255)")]
        public string? Description { get; set; } = string.Empty;

        /// <summary>
        /// 规格信息Json
        /// </summary>
        [Column(TypeName = "text")]
        public string? SpecificationJson { get; set; } = string.Empty;        

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

        /// <summary>
        /// 最小重量（有SKU的时候生效）
        /// </summary>
        [Column(TypeName = "decimal(6,2)")]
        public decimal? MinWeight { get; set; }

        /// <summary>
        /// 最大重量（有SKU的时候生效）
        /// </summary>
        [Column(TypeName = "decimal(6,2)")]
        public decimal? MaxWeight { get; set; }

        /// <summary>
        /// 市场价，划线价
        /// </summary>
        [Column(TypeName = "decimal(18,4)")]
        public decimal MarketPrice { get; set; }

        /// <summary>
        /// 销售标价
        /// </summary>
        [Column(TypeName = "decimal(18,4)")]
        public decimal Price { get; set; }

        /// <summary>
        /// SKU组合的产品价格信息
        /// </summary>
        [Column(TypeName = "text")]
        public string? SkuPrices { get; set; } = string.Empty;

        /// <summary>
        /// 商品扩展信息
        /// </summary>
        [Column(TypeName = "text")]
        public string Extended { get; set; } = string.Empty;

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

        /// <summary>
        /// 产品信息审核状态
        /// </summary>
        public int ReviewStatus { get; set; }

        /// <summary>
        /// 库存管理模式,0不跟踪库存，1以产品跟踪库存，2以SKU跟踪库存
        /// </summary>
        public int InventoryMethod { get; set; }

        /// <summary>
        /// 商品库存
        /// </summary>
        public int StockQuantity { get; set; }

        /// <summary>
        /// 总销售数量
        /// </summary>
        public int SalesQuantity { get; set; }

        /// <summary>
        /// 图片数量
        /// </summary>
        public int PictureCount { get; set; }

        /// <summary>
        /// 产品状态，0未上架，1上架
        /// </summary>

        public int Status { get; set; }

        /// <summary>
        /// 是否逻辑删除
        /// </summary>
        public bool Deleted { get; set; }

        /// <summary>
        /// 删除时间
        /// </summary>
        [Column(TypeName = "timestamptz")]

        public DateTime? DeletedTime { get; set; }

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

        public DateTime CreateTime { get; set; }

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