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