using FluentValidation;
using AdsTrackingService.API.Application.Commands;

namespace AdsTrackingService.API.Application.Validations;

/// <summary>
/// EN: Validator for RecordConversionCommand.
/// VI: Validator cho RecordConversionCommand.
/// </summary>
public class RecordConversionCommandValidator : AbstractValidator<RecordConversionCommand>
{
    public RecordConversionCommandValidator()
    {
        RuleFor(x => x.AdvertiserId)
            .NotEmpty()
            .WithMessage("Advertiser ID is required / Advertiser ID là bắt buộc");

        RuleFor(x => x.CampaignId)
            .NotEmpty()
            .WithMessage("Campaign ID is required / Campaign ID là bắt buộc");

        RuleFor(x => x.UserId)
            .NotEmpty()
            .WithMessage("User ID is required / User ID là bắt buộc");

        RuleFor(x => x.ConversionType)
            .NotEmpty()
            .WithMessage("Conversion type is required / Loại conversion là bắt buộc")
            .MaximumLength(100)
            .WithMessage("Conversion type max 100 characters / Loại conversion tối đa 100 ký tự");

        RuleFor(x => x.ConversionValue)
            .GreaterThanOrEqualTo(0)
            .WithMessage("Conversion value must be >= 0 / Giá trị conversion phải >= 0");

        RuleFor(x => x.Currency)
            .NotEmpty()
            .WithMessage("Currency is required / Đơn vị tiền tệ là bắt buộc")
            .MaximumLength(3)
            .WithMessage("Currency code max 3 characters / Mã tiền tệ tối đa 3 ký tự");
    }
}
