---
# System prepended metadata

title: Untitled

---

```csharp=

// PRODUCT ENTITY
public class MKProduct {
    public string Id { get; set; }
    public Locale Name { get; set; }
    public Locale Label { get; set; }
    public string StoreId { get; set; }
    public string CategoryId { get; set; }
    // public string Unit { get; set; }
    public decimal Rating { get; set; } 
    public int Sold { get; set; }
    public string Sku { get; set; }
    public string HiveSKU { get; set; } // generate uniqe
    public double Instock { get; set; }
    public decimal Width { get; set; }
    public decimal Height { get; set; }
    public decimal Depth { get; set; }
    public decimal Weight { get; set; }
    // public decimal Volume { get; set; }
    // public string ShelfLife { get; set; }
    public string Description { get; set; }
    public int ProductVolumeTradeUnitId { get; set; }
    public int ProductPriceId { get; set; }
    // public int ProductUnitConversionId { get; set; }
    public string PreOrderMode { get; set; } = INSTOCK
    // public ProductPreOrder PreOrderWeek { get; set; }
    // public ProductPreOrder PreOrderMonth { get; set; }
    public ProductStatus { get; set; } // ACTIVE / INACTIVE / SUSPEND / OUT_OF_STOCK
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }
    
    // Relate
    public ICollection<Image> Images { get; set; }
    public ProductVolumeTradeUnit ProductVolumeTradeUnit { get; set; }
    public ProductPrice ProductPrice { get; set; }
    public ICollection<ProductCategoryAttributeValue> ProductCategoryAttributeValue { get; set; } // v1
    public ICollection<ProductBaseAttributeValue> ProductBaseAttributeValue { get; set; } // v1
    
    // add new fields
    public string CreatedBy { get; set; }
    public string UpdatedBy { get; set; }
}


public class ProductPreOrder {
    public int Id { get; set; }
    public int ProductId { get; set; }
    public string Day { get; set; }
}


// PRODUCT PRICE ENTITY
public class ProductPrice {
    public string Id
    public bool HasVat = IncludeVat // product มี vat/ ไม่มี vat
    public bool IncludeVat // ราคา include vat / exclude vat
    public bool AllowQuotation
    // public bool ToggleDateTime
    // public decimal SortPrice // ใส่ product price
    public int UnitId
    // public decimal Stepping
        
    // Relate
    public ICollection<ProductPriceTier> ProductPriceTiers { get; set; }
}

// PRODUCT PRICE TIER ENTITY
public class ProductPriceTier {
    public int ProductPriceId
    public int Tier
    public decimal Min // volume
    public decimal Max // volume
    public decimal Price
    public bool IsActive
    public string PriceType
}

// PRODUCT PROMOTION PRICE TIER ENTITY
public class ProductPromotionPriceTier {
    public int ProductPriceId
    public int Tier
    public decimal Price
    public string PriceType
    public DateTime StartDate
    public DateTime EndDate
}

// PRODUCT VOLUME TRADE UNIT ENTITY
public class ProductVolumeTradeUnit {
    public string Id
    public string VolumeType => "STATIC"
    public decimal MinVolume => 1
    public decimal MaxVolume => 1
    public int VolumeUnitId = TradeUnitId = unitId
    public int TradeUnitId
}

// IMAGE ENTITY
public class Image {
    public string Id { get; set; }
    public string Url { get; set; }
    public Image Image { get; set; } // new field +
    public int? Sequence { get; set; }
    public string ProductId { get; set; }
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }
}

```

