using FluentValidation;
using AdsManagerService.API.Application.Commands;

namespace AdsManagerService.API.Application.Validations;

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

        RuleFor(x => x.Name)
            .NotEmpty()
            .WithMessage("Campaign name is required / Tên chiến dịch là bắt buộc")
            .MaximumLength(200)
            .WithMessage("Campaign name max 200 characters / Tên chiến dịch tối đa 200 ký tự");

        RuleFor(x => x.Description)
            .MaximumLength(1000)
            .When(x => x.Description != null)
            .WithMessage("Description max 1000 characters / Mô tả tối đa 1000 ký tự");
    }
}
