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