/* * Copyright (C) 2023 Simon Bruder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package catering.inventory; import java.util.Optional; import org.salespointframework.quantity.Quantity; import catering.catalog.CatalogDummyType; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.PositiveOrZero; // NonNegative in enterprise java class InventoryMutateForm { private final @NotNull CatalogDummyType type; private final @NotEmpty String name; private final @NotNull Quantity quantity; private final @NotNull double wholesalePrice, retailPrice; private final @NotNull Optional promotionPrice; public InventoryMutateForm(@NotNull CatalogDummyType type, @NotEmpty String name, @NotNull Quantity quantity, @PositiveOrZero double wholesalePrice, @PositiveOrZero double retailPrice, @PositiveOrZero Optional promotionPrice) { this.type = type; this.name = name; this.quantity = quantity; this.wholesalePrice = wholesalePrice; this.retailPrice = retailPrice; this.promotionPrice = promotionPrice; } public static InventoryMutateForm empty() { return new InventoryMutateForm(null, "", Quantity.of(0), 0, 0, Optional.empty()); } public CatalogDummyType getType() { return type; } public String getName() { return name; } public Quantity getQuantity() { return quantity; } public double getWholesalePrice() { return wholesalePrice; } public double getRetailPrice() { return retailPrice; } public Optional getPromotionPrice() { return promotionPrice; } }