// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.ComponentModel.DataAnnotations;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Entities.Rules.Runner;
using Squidex.Infrastructure.Reflection;
namespace Squidex.Areas.Api.Controllers.Rules.Models
{
public sealed record SimulatedRuleEventDto
{
///
/// The name of the event.
///
[Required]
public string EventName { get; set; }
///
/// The source event.
///
[Required]
public object Event { get; set; }
///
/// The enriched event.
///
public object? EnrichedEvent { get; set; }
///
/// The data for the action.
///
public string? ActionName { get; set; }
///
/// The name of the action.
///
public string? ActionData { get; set; }
///
/// The name of the event.
///
public string? Error { get; set; }
///
/// The reason why the event has been skipped.
///
[Required]
public SkipReason SkipReason { get; set; }
public static SimulatedRuleEventDto FromSimulatedRuleEvent(SimulatedRuleEvent ruleEvent)
{
return SimpleMapper.Map(ruleEvent, new SimulatedRuleEventDto());
}
}
}