BotSharp/src/Infrastructure/BotSharp.Abstraction/Routing/Models/RoutingArgs.cs

33 lines
900 B
C#
Raw Normal View History

2023-08-28 03:50:10 +00:00
namespace BotSharp.Abstraction.Routing.Models;
public class RoutingArgs
{
2023-09-26 16:18:42 +00:00
[JsonPropertyName("function")]
public string Function { get; set; } = string.Empty;
[JsonPropertyName("reason")]
public string Reason { get; set; } = string.Empty;
[JsonPropertyName("answer")]
2023-10-12 00:59:09 +00:00
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Answer { get; set; }
2023-09-26 16:18:42 +00:00
2023-09-24 21:32:58 +00:00
[JsonPropertyName("agent")]
2023-10-12 00:59:09 +00:00
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? AgentName { get; set; }
public override string ToString()
{
2023-09-26 16:18:42 +00:00
var route = string.IsNullOrEmpty(AgentName) ? "" : $"<Route to {AgentName.ToUpper()} because {Reason}>";
if (string.IsNullOrEmpty(Answer))
{
return $"[{Function} {route}]";
}
else
{
return $"[{Function} {route}] => {Answer}";
}
}
}