spec library_fees
"""
Library Late Fees
Shows conditional logic with unless clauses.
Easy to understand: books returned late incur fees.
"""
data money: measure
-> decimals 2
-> unit eur 1.00
-> minimum 0 eur
data book_kind: text
-> option "regular"
-> option "reference"
-> option "new_release"
data book_type: book_kind
data is_first_offense: boolean
data days_overdue: number
-> minimum 0
rule daily_fee: 0 eur
unless book_type is "regular" then 0.25 eur
unless book_type is "reference" then 0.5 eur
unless book_type is "new_release" then 1 eur
rule is_in_grace_period: days_overdue <= 3
unless book_type is "new_release" then no
rule total_fee: days_overdue * daily_fee
rule final_fee: total_fee
unless is_first_offense then total_fee * 50%
unless is_in_grace_period then 0 eur
rule can_checkout: yes
unless final_fee > 10 eur then no