using ElectricalRepairServiceContract.Exceptions; using ElectricalRepairServiceContract.Extensions; using ElectricalRepairServiceContract.Interfaces; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ElectricalRepairServiceContract.DataModels { public class DetailsUseDataModel : IValidation { public string DetailsId { get; private set; } public string RequestId { get; private set; } public int Count { get; private set; } public DetailsUseDataModel(string detailsId, string requestId, int count) { DetailsId = detailsId; RequestId = requestId; Count = count; } public void Validate() { if (DetailsId.IsEmpty()) throw new ValidationException("Field DetailsId is empty"); if (!DetailsId.IsGuid()) throw new ValidationException("The value in the field DetailsId is not a unique identifier"); if (RequestId.IsEmpty()) throw new ValidationException("Field RequestId is empty"); if (!RequestId.IsGuid()) throw new ValidationException("The value in the field RequestId is not a unique identifier"); if (Count <= 0) throw new ValidationException("The count must be positive"); } } }