using BitterlyAndExclamationMarkContracts.Exceptions; using BitterlyAndExclamationMarkContracts.Extensions; using BitterlyAndExclamationMarkContracts.Infrastructure; namespace BitterlyAndExclamationMarkContracts.DataModels; public class OrderDishDataModel(string orderId, string dishId, int count) : IValidation { public string OrderId { get; private set; } = orderId; public string DishId { get; private set; } = dishId; public int Count { get; private set; } = count; public void Validate() { if (OrderId.IsEmpty()) throw new ValidationException("Field OrderId is empty"); if (!OrderId.IsGuid()) throw new ValidationException("The value in the field OrderId is not a unique identifier"); if (DishId.IsEmpty()) throw new ValidationException("Field DishId is empty"); if (!DishId.IsGuid()) throw new ValidationException("The value in the field DishId is not a unique identifier"); if (Count <= 0) throw new ValidationException("Field Count is less than or equal to 0"); } }