using System;
using FluentValidation;
using OnlineAssessment.Domain.ViewModels;

namespace OnlineAssessment.Validators
{
    public class InstituteAddModelValidator : AbstractValidator<InstituteAddModel>
    {
        public InstituteAddModelValidator()
        {
            RuleFor(i => i.Name)
               .NotEmpty()
               .NotNull()
               .MaximumLength(500);

            RuleFor(u => u.SubscriptionId)
               .NotEmpty()
               .NotNull()
               .GreaterThan(0);

            RuleFor(u => u.Domain)
                .Length(0, 500);

            RuleFor(u => u.ApiKey)
                .Length(0, 500);

            RuleFor(u => u.Address)
                .Length(0, 1500);

            RuleFor(u => u.City)
                .Length(0, 1500);

            RuleFor(u => u.DateOfEstablishment)
                .LessThan(DateTime.Now);

            RuleFor(u => u.PinCode)
                .Length(0, 6);


        }
    }
}
