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

45 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!;
2025-03-10 22:03:23 +00:00
[JsonPropertyName("created_time")]
public DateTime CreatedTime { get; set; }
2025-01-30 21:58:57 +00:00
2025-03-10 22:03:23 +00:00
[JsonPropertyName("updated_time")]
public DateTime UpdatedTime { get; set; }
2025-01-30 21:58:57 +00:00
2024-02-02 22:36:05 +00:00
[JsonPropertyName("agent_id")]
2025-01-30 17:10:15 +00:00
public string AgentId { get; set; } = null!;
2025-01-30 21:58:57 +00:00
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,
2025-03-10 22:03:23 +00:00
CreatedTime = task.CreatedTime,
UpdatedTime = task.UpdatedTime
2024-02-02 22:36:05 +00:00
};
}
}