using TwoFromTheCaseContracts.Exceptions; using TwoFromTheCaseContracts.Extensions; using TwoFromTheCaseContracts.Infrastructure; namespace TwoFromTheCaseContracts.DataModels; public class WorkerWorkDataModel(string workerId, string workId, double hours) : IValidation { public string WorkerId { get; private set; } = workerId; public string WorkId { get; private set; } = workId; public double Hours { get; private set; } = hours; public void Validate() { if (WorkerId.IsEmpty()) throw new ValidationException("Field WorkerId is empty"); if (!WorkerId.IsGuid()) throw new ValidationException("The value in the field WorkerId is not a unique identifier"); if (WorkId.IsEmpty()) throw new ValidationException("Field WorkId is empty"); if (!WorkId.IsGuid()) throw new ValidationException("The value in the field WorkId is not a unique identifier"); if (Hours <= 0) throw new ValidationException("Field Hours is less than or equal to 0"); } }