1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use ;
use crateCurrency;
/// Represents different types of markup that can be applied to a product's price.
///
/// Markup is the added value on top of the base (buy) price, and can be represented in
/// several formats:
///
/// - A fixed amount in a specific currency
/// - A percentage increase relative to the buy price
/// - A commission-style markup, where the markup is calculated based on the final price
///
/// # Variants
///
/// - `Amount`:
/// A fixed value of markup in a specific currency (e.g. 50,000 IDR or 10 USD).
/// The system will convert this amount to the `buy_currency` internally.
///
/// - `Percentage`:
/// A simple percentage markup added to the buy price (e.g. 10% → buy_price × 1.10).
///
/// - `Commission`:
/// A commission-style markup where the final sell price should include a certain
/// percentage as commission. Internally calculated as:
/// `buy_price / (1 - commission%)`
///
/// # Examples
///
/// ```code
/// MarkupType::Amount { value: 50000.0, currency: Currency::new("IDR", "Indonesian Rupiah") };
/// MarkupType::Percentage(15.0);
/// MarkupType::Commission(10.0);
/// ```