using TwoFromTheCaseContracts.Enums; using TwoFromTheCaseContracts.Exceptions; using TwoFromTheCaseContracts.Extensions; using TwoFromTheCaseContracts.Infrastructure; namespace TwoFromTheCaseContracts.DataModels; public class PremisesDataModel(string id, PremisesType premisesType, string customerId, bool isDeleted) : IValidation { public string Id { get; private set; } = id; public PremisesType PremisesType { get; private set; } = premisesType; public string CustomerId { get; private set; } = customerId; public bool IsDeleted { get; private set; } = isDeleted; public void Validate() { if (Id.IsEmpty()) throw new ValidationException("Field Id is empty"); if (!Id.IsGuid()) throw new ValidationException("The value in the field Id is not a unique identifier"); if (PremisesType == PremisesType.None) throw new ValidationException("Field PremisesType is empty"); if (CustomerId.IsEmpty()) throw new ValidationException("Field CustomerId is empty"); if (!CustomerId.IsGuid()) throw new ValidationException("The value in the field CustomerId is not a unique identifier"); } }