// EN: Validators for Barista queue commands.
// VI: Validators cho cac commands hang doi Barista.

using FluentValidation;
using FnbEngine.API.Application.Commands;

namespace FnbEngine.API.Application.Validations;

/// <summary>
/// EN: Validator for QueueDrinkCommand.
/// VI: Validator cho QueueDrinkCommand.
/// </summary>
public class QueueDrinkCommandValidator : AbstractValidator<QueueDrinkCommand>
{
    public QueueDrinkCommandValidator()
    {
        RuleFor(x => x.ShopId)
            .NotEmpty()
            .WithMessage("Shop ID is required / Shop ID la bat buoc");

        RuleFor(x => x.OrderId)
            .NotEmpty()
            .WithMessage("Order ID is required / Order ID la bat buoc");

        RuleFor(x => x.OrderItemId)
            .NotEmpty()
            .WithMessage("Order item ID is required / Order item ID la bat buoc");

        RuleFor(x => x.DrinkName)
            .NotEmpty()
            .WithMessage("Drink name is required / Ten do uong la bat buoc")
            .MaximumLength(200)
            .WithMessage("Drink name must not exceed 200 characters / Ten do uong khong vuot qua 200 ky tu");

        RuleFor(x => x.Customizations)
            .MaximumLength(2000)
            .WithMessage("Customizations must not exceed 2000 characters / Tuy chinh khong vuot qua 2000 ky tu")
            .When(x => x.Customizations != null);

        RuleFor(x => x.Priority)
            .InclusiveBetween(0, 10)
            .WithMessage("Priority must be between 0 and 10 / Do uu tien phai tu 0 den 10");

        RuleFor(x => x.EstimatedMinutes)
            .InclusiveBetween(1, 60)
            .WithMessage("Estimated minutes must be between 1 and 60 / Thoi gian du kien phai tu 1 den 60 phut");
    }
}

/// <summary>
/// EN: Validator for StartPreparingCommand.
/// VI: Validator cho StartPreparingCommand.
/// </summary>
public class StartPreparingCommandValidator : AbstractValidator<StartPreparingCommand>
{
    public StartPreparingCommandValidator()
    {
        RuleFor(x => x.QueueItemId)
            .NotEmpty()
            .WithMessage("Queue item ID is required / Queue item ID la bat buoc");

        RuleFor(x => x.BaristaName)
            .NotEmpty()
            .WithMessage("Barista name is required / Ten barista la bat buoc")
            .MaximumLength(100)
            .WithMessage("Barista name must not exceed 100 characters / Ten barista khong vuot qua 100 ky tu");
    }
}

/// <summary>
/// EN: Validator for MarkDrinkReadyCommand.
/// VI: Validator cho MarkDrinkReadyCommand.
/// </summary>
public class MarkDrinkReadyCommandValidator : AbstractValidator<MarkDrinkReadyCommand>
{
    public MarkDrinkReadyCommandValidator()
    {
        RuleFor(x => x.QueueItemId)
            .NotEmpty()
            .WithMessage("Queue item ID is required / Queue item ID la bat buoc");
    }
}

/// <summary>
/// EN: Validator for MarkDrinkDeliveredCommand.
/// VI: Validator cho MarkDrinkDeliveredCommand.
/// </summary>
public class MarkDrinkDeliveredCommandValidator : AbstractValidator<MarkDrinkDeliveredCommand>
{
    public MarkDrinkDeliveredCommandValidator()
    {
        RuleFor(x => x.QueueItemId)
            .NotEmpty()
            .WithMessage("Queue item ID is required / Queue item ID la bat buoc");
    }
}

/// <summary>
/// EN: Validator for CancelQueueItemCommand.
/// VI: Validator cho CancelQueueItemCommand.
/// </summary>
public class CancelQueueItemCommandValidator : AbstractValidator<CancelQueueItemCommand>
{
    public CancelQueueItemCommandValidator()
    {
        RuleFor(x => x.QueueItemId)
            .NotEmpty()
            .WithMessage("Queue item ID is required / Queue item ID la bat buoc");
    }
}
