BotSharp/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentTaskViewModel.cs

42 lines
1.3 KiB
C#
Raw Normal View History

2024-02-02 22:36:05 +00:00
using BotSharp.Abstraction.Tasks.Models;
using System.Text.Json.Serialization;
namespace BotSharp.OpenAPI.ViewModels.Agents;
public class AgentTaskViewModel
{
2025-01-30 17:10:15 +00:00
public string Id { get; set; } = null!;
public string Name { get; set; } = null!;
2024-02-02 22:36:05 +00:00
public string? Description { get; set; }
2025-01-30 17:10:15 +00:00
public string Content { get; set; } = null!;
2024-02-02 22:36:05 +00:00
public bool Enabled { get; set; }
2025-01-30 17:10:15 +00:00
public string Status { get; set; } = null!;
2024-02-02 22:36:05 +00:00
[JsonPropertyName("created_datetime")]
public DateTime CreatedDateTime { get; set; }
[JsonPropertyName("updated_datetime")]
public DateTime UpdatedDateTime { get; set; }
[JsonPropertyName("agent_id")]
2025-01-30 17:10:15 +00:00
public string AgentId { get; set; } = null!;
2024-02-02 22:36:05 +00:00
[JsonPropertyName("agent_name")]
2025-01-30 17:10:15 +00:00
public string AgentName { get; set; } = null!;
2024-02-02 22:36:05 +00:00
public static AgentTaskViewModel From(AgentTask task)
{
return new AgentTaskViewModel
{
Id = task.Id,
Name = task.Name,
Description = task.Description,
Content = task.Content,
Enabled = task.Enabled,
2024-02-04 20:01:56 +00:00
AgentId = task.AgentId,
AgentName = task.Agent?.Name,
2025-01-30 17:10:15 +00:00
Status = task.Status,
2024-02-02 22:36:05 +00:00
CreatedDateTime = task.CreatedDateTime,
2024-02-05 00:38:00 +00:00
UpdatedDateTime = task.UpdatedDateTime
2024-02-02 22:36:05 +00:00
};
}
}