Source: pharmanet/lib/core/models/promotion_model.dart
| Field |
Type |
Description |
id |
String |
UUID |
title |
String |
Campaign name |
description |
String? |
Campaign details |
bannerId |
String? |
FK to banners |
status |
String |
draft, active, ended, cancelled |
startDate |
DateTime |
Campaign start |
endDate |
DateTime |
Campaign end |
createdBy |
String? |
Admin who created it |
createdAt |
DateTime? |
Creation timestamp |
updatedAt |
DateTime? |
Last update |
OfferProduct — @freezed
| Field |
Type |
Description |
id |
String |
UUID |
productId |
String |
FK to products |
promotionId |
String |
FK to promotions |
pharmacyId |
String |
FK to sellers |
discountType |
String |
percentage or fixed |
discountValue |
double |
Discount amount |
originalPrice |
double |
Product price when offer created |
offerPrice |
double |
Computed discounted price |
maxQuantity |
int? |
Max units per customer |
isActive |
bool |
Toggle active/inactive |
createdAt |
DateTime? |
Creation timestamp |
updatedAt |
DateTime? |
Last update |
Offer Price Calculation
if (discountType == 'percentage') {
offerPrice = originalPrice - (originalPrice * discountValue / 100);
} else {
offerPrice = originalPrice - discountValue;
}