Skip to content

Product Models

Source: pharmanet/lib/core/models/product_model.dart

Product — @freezed

Field Type Description
id String UUID
sellerId String FK to sellers
categoryId String? FK to categories
brandId String? FK to brands
name String Product name
slug String? URL-friendly name
sku String? Stock keeping unit
description String? Full description
shortDescription String? Brief summary
price double Base price
discountPrice double? Discount price
discountStart DateTime? Discount start
discountEnd DateTime? Discount end
costPrice double? Wholesale cost
quantity int Stock count
lowStockThreshold int? Low stock alert
dosage String? Medication dosage
expiryDate DateTime? Expiry date
manufacturer String? Manufacturer name
prescriptionRequired bool Rx required flag
isFeatured bool Featured (boosted) flag
isPublished bool Published status
isBoosted bool Boost active
approvalStatus String pending, approved, rejected
views int View count
rating double Average rating
reviewCount int Review count
images List<String> Product image URLs
soldCount int Units sold
categories Category? Included category data
sellers Seller? Included seller data
variantOptions List<VariantOption>? Variant definitions
variantCombinations List<VariantCombination>? SKU variants

Category — @freezed

Field Type Description
id String UUID
name String Category name
description String? Category description
image String? Category image URL
parentId String? Parent category (self-ref)
sortOrder int Display order
status String active, inactive

Brand — @freezed

Field Type Description
id String UUID
name String Brand name
slug String URL-friendly
logo String? Brand logo URL
description String? Brand info
isActive bool Active flag

VariantOption — @freezed

Field Type Description
id String UUID
productId String FK to products
optionName String e.g., "Size", "Color"
optionPosition int Sort order

VariantValue — @freezed

Field Type Description
id String UUID
variantOptionId String FK to variant_options
valueName String e.g., "Small", "Red"
valuePosition int Sort order

VariantCombination — @freezed

Field Type Description
id String UUID
productId String FK to products
sku String Unique SKU
price double Variant-specific price
stockQuantity int Variant-specific stock
imageUrl String? Variant-specific image
isActive bool Active flag

ProductParams — @freezed

Field Type Description
sellerId String? Filter by seller
categoryId String? Filter by category
search String? Search query
minPrice / maxPrice double? Price range
minRating double? Minimum rating
prescriptionRequired bool? Rx filter
inStock bool? Stock filter
page / limit int Pagination (default: 1/20)
isPublished bool Published filter