from verada import ensures, old, requires
import Ada.Text_IO as T
import stock
from dataclasses import dataclass


@dataclass
class Counter:
    value: int

    def add(self, amount: int, times: int) -> None:
        requires(0 <= amount <= 100 and 0 <= times <= 100 and 0 <= self.value <= 10_000)
        ensures(self.value == old(self.value) + amount * times)
        self.value += amount * times


# an `as` name for a Vada package, a class constructed through its module, and a method
# called with keyword arguments
def main() -> None:
    T.Put_Line("hi")
    items: stock.Shelf = stock.Shelf([10, 20, 30])
    print(stock.total(items))
    c = Counter(value=1)
    c.add(2, times=3)
    c.add(amount=1, times=1)
    print(c.value)


if __name__ == "__main__":
    main()
