package models import "time" type Product struct { ID int Name string Description string Details string Price float64 SalePrice float64 ImageURL string Category string CategoryID *int CategorySlug string IsActive bool AttrSize string AttrColor string AttrMaterial string AttrWeight string AttrBrand string CreatedAt time.Time UpdatedAt time.Time Images []ProductImage } func (p Product) EffectivePrice() float64 { if p.SalePrice > 0 && p.SalePrice < p.Price { return p.SalePrice } return p.Price } func (p Product) HasSale() bool { return p.SalePrice > 0 && p.SalePrice < p.Price } func (p Product) DiscountPercent() int { if !p.HasSale() || p.Price <= 0 { return 0 } return int((1 - p.SalePrice/p.Price) * 100) } type ProductImage struct { ID int ProductID int FilePath string IsPrimary bool SortOrder int CreatedAt time.Time } type Category struct { ID int Name string Slug string Description string SortOrder int Count int } type SiteStats struct { TotalVisits int64 TodayVisits int }