// EN: Validator for GetStaffPerformanceQuery.
// VI: Validator cho GetStaffPerformanceQuery.

using FluentValidation;
using OrderService.API.Application.Queries.Reports;

namespace OrderService.API.Application.Validations;

/// <summary>
/// EN: Validator for GetStaffPerformanceQuery — validates date range and shop ID.
/// VI: Validator cho GetStaffPerformanceQuery — kiem tra khoang ngay va shop ID.
/// </summary>
public class GetStaffPerformanceQueryValidator : AbstractValidator<GetStaffPerformanceQuery>
{
    public GetStaffPerformanceQueryValidator()
    {
        RuleFor(x => x.ShopId)
            .NotEmpty()
            .WithMessage("EN: Shop ID is required / VI: Shop ID la bat buoc");

        RuleFor(x => x.StartDate)
            .NotEmpty()
            .WithMessage("EN: Start date is required / VI: Ngay bat dau la bat buoc")
            .LessThan(x => x.EndDate)
            .WithMessage("EN: Start date must be before end date / VI: Ngay bat dau phai truoc ngay ket thuc");

        RuleFor(x => x.EndDate)
            .NotEmpty()
            .WithMessage("EN: End date is required / VI: Ngay ket thuc la bat buoc")
            .Must(d => d <= DateTime.UtcNow.Date.AddDays(1))
            .WithMessage("EN: End date cannot be in the future / VI: Ngày kết thúc không thể trong tương lai");
    }
}
