Files
tiku-backend.net/Tiku.Api/Contracts/CrmDtos.cs
2026-07-26 20:26:08 +08:00

105 lines
2.2 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.Text.Json;
using Tiku.Application.Growth;
namespace Tiku.Api.Contracts;
public sealed class UpsertCrmConfigDto
{
public bool Enabled { get; set; }
[StringLength(2048)]
public string? Url { get; set; }
[StringLength(300)]
public string? SecretRef { get; set; }
public string? Secret { get; set; }
[StringLength(200)]
public string? FormName { get; set; }
[StringLength(100)]
public string? ExamType { get; set; }
[Range(1, 120)]
public int? TimeoutSeconds { get; set; }
[Range(0, 86400)]
public int? DelaySeconds { get; set; }
[StringLength(50)]
public string? AssignmentMode { get; set; }
public JsonElement? AssignmentPool { get; set; }
public JsonElement? AssignmentConfig { get; set; }
public UpsertCrmConfigCommand ToCommand()
{
return new UpsertCrmConfigCommand(
Enabled,
Url,
SecretRef,
Secret,
FormName,
ExamType,
TimeoutSeconds,
DelaySeconds,
AssignmentMode,
AssignmentPool,
AssignmentConfig);
}
}
public sealed class CrmQueueQueryDto
{
[StringLength(50)]
public string? Status { get; set; }
public Guid? QueueId { get; set; }
[StringLength(200)]
public string? Source { get; set; }
[Range(1, 500)]
public int? Limit { get; set; }
public CrmQueueQuery ToQuery()
{
return new CrmQueueQuery(Status, QueueId, Source, Limit);
}
}
public sealed class CrmQueueLogQueryDto
{
public Guid? QueueId { get; set; }
[Range(1, 200)]
public int? Limit { get; set; }
public CrmQueueLogQuery ToQuery()
{
return new CrmQueueLogQuery(QueueId, Limit);
}
}
public sealed class CrmQueueActionDto
{
[Required]
public Guid QueueId { get; set; }
[StringLength(50)]
public string? Action { get; set; }
[StringLength(500)]
public string? Note { get; set; }
public JsonElement? Metadata { get; set; }
public CrmQueueActionCommand ToCommand()
{
return new CrmQueueActionCommand(QueueId, Action, Note, Metadata);
}
}