using FluentValidation;
using Meezi.API.Models.Hr;
using Meezi.Core.Enums;

namespace Meezi.API.Validators;

public class CreateLeaveRequestValidator : AbstractValidator<CreateLeaveRequest>
{
    public CreateLeaveRequestValidator()
    {
        RuleFor(x => x.EndDate).GreaterThanOrEqualTo(x => x.StartDate);
    }
}

public class ReviewLeaveRequestValidator : AbstractValidator<ReviewLeaveRequest>
{
    public ReviewLeaveRequestValidator()
    {
        RuleFor(x => x.Status)
            .Must(s => s is LeaveStatus.Approved or LeaveStatus.Rejected)
            .WithMessage("Status must be Approved or Rejected.");
    }
}

public class CreateSalaryRequestValidator : AbstractValidator<CreateSalaryRequest>
{
    public CreateSalaryRequestValidator()
    {
        RuleFor(x => x.EmployeeId).NotEmpty();
        RuleFor(x => x.MonthYear).Matches(@"^\d{4}-\d{2}$");
        RuleFor(x => x.BaseSalary).GreaterThanOrEqualTo(0);
    }
}
