﻿using EzApp.Validation.Core.Errors;
using EzApp.Validation.Core.Validators.EntityValidators.ValidationResults;

namespace EzApp.Validation.Validators.EntityValidators.ValidationResults
{
    public class EzEntityValidationResult
        <TEntityDto,
        TEntityFieldErrorCollection>

        :
        IEzEntityValidationResult
            <TEntityDto,
            TEntityFieldErrorCollection>
    {
        public EzEntityValidationResult(TEntityDto entitytDto, IEzEntityErrorCollection<TEntityFieldErrorCollection> errors)
        {
            EntityDto = entitytDto;
            Errors = errors;
        }

        public bool IsValid => Errors == null || Errors.IsValid;
        public TEntityDto EntityDto { get; private set; }
        public IEzEntityErrorCollection<TEntityFieldErrorCollection> Errors { get; private set; }
    }
}
