Files
29WxOrder/test/OrderSupportTicket.TestServer/Contracts/ApiContracts.cs
T
2026-10-18 20:36:40 +08:00

407 lines
10 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace OrderSupportTicket.TestServer.Contracts;
public sealed class CreateWorkOrderRequest
{
[Required]
[JsonPropertyName("purchaseAccount")]
public string? PurchaseAccount { get; set; }
[Required]
[JsonPropertyName("appId")]
public string? AppId { get; set; }
[Required]
[JsonPropertyName("wechatOrderId")]
public string? WechatOrderId { get; set; }
[Required]
[JsonPropertyName("description")]
public string? Description { get; set; }
[JsonPropertyName("clientRequestId")]
public string? ClientRequestId { get; set; }
}
public sealed class ListWorkOrdersRequest
{
[Required]
[JsonPropertyName("purchaseAccount")]
public string? PurchaseAccount { get; set; }
[Required]
[JsonPropertyName("appIds")]
public List<string>? AppIds { get; set; }
[JsonPropertyName("wechatOrderId")]
public string? WechatOrderId { get; set; }
[JsonPropertyName("status")]
public string? Status { get; set; }
[Range(1, 100)]
[JsonPropertyName("limit")]
public int Limit { get; set; } = 20;
[JsonPropertyName("cursor")]
public string? Cursor { get; set; }
}
public sealed class GetMessagesRequest
{
[Required]
[JsonPropertyName("purchaseAccount")]
public string? PurchaseAccount { get; set; }
[Required]
[JsonPropertyName("appId")]
public string? AppId { get; set; }
[Required]
[JsonPropertyName("wechatOrderId")]
public string? WechatOrderId { get; set; }
[Range(1, 100)]
[JsonPropertyName("limit")]
public int Limit { get; set; } = 50;
[JsonPropertyName("before")]
public string? Before { get; set; }
}
public sealed class SendMessageRequest
{
[Required]
[JsonPropertyName("purchaseAccount")]
public string? PurchaseAccount { get; set; }
[Required]
[JsonPropertyName("appId")]
public string? AppId { get; set; }
[Required]
[JsonPropertyName("clientMessageId")]
public string? ClientMessageId { get; set; }
[Required]
[JsonPropertyName("text")]
public string? Text { get; set; }
}
public sealed class MarkReadRequest
{
[Required]
[JsonPropertyName("purchaseAccount")]
public string? PurchaseAccount { get; set; }
[Required]
[JsonPropertyName("appId")]
public string? AppId { get; set; }
[Range(1, int.MaxValue)]
[JsonPropertyName("throughSequenceNo")]
public int ThroughSequenceNo { get; set; }
}
public sealed class WorkOrderListResponse
{
[JsonPropertyName("success")]
public bool Success { get; set; } = true;
[JsonPropertyName("items")]
public List<WorkOrderSummaryDto> Items { get; set; } = [];
[JsonPropertyName("hasMore")]
public bool HasMore { get; set; }
[JsonPropertyName("nextCursor")]
public string? NextCursor { get; set; }
[JsonPropertyName("identityVerified")]
public bool IdentityVerified { get; set; }
}
public sealed class WorkOrderSummaryDto
{
[JsonPropertyName("appId")]
public string AppId { get; set; } = string.Empty;
[JsonPropertyName("wechatOrderId")]
public string WechatOrderId { get; set; } = string.Empty;
[JsonPropertyName("status")]
public string Status { get; set; } = string.Empty;
[JsonPropertyName("statusText")]
public string StatusText { get; set; } = string.Empty;
[JsonPropertyName("createdAt")]
public string CreatedAt { get; set; } = string.Empty;
[JsonPropertyName("updatedAt")]
public string UpdatedAt { get; set; } = string.Empty;
[JsonPropertyName("lastMessageAt")]
public string LastMessageAt { get; set; } = string.Empty;
[JsonPropertyName("lastReplyAt")]
public string? LastReplyAt { get; set; }
[JsonPropertyName("lastSenderType")]
public string? LastSenderType { get; set; }
[JsonPropertyName("unreadCount")]
public int UnreadCount { get; set; }
[JsonPropertyName("version")]
public string Version { get; set; } = "1";
}
public sealed class WorkOrderMessagesResponse
{
[JsonPropertyName("success")]
public bool Success { get; set; } = true;
[JsonPropertyName("appId")]
public string AppId { get; set; } = string.Empty;
[JsonPropertyName("wechatOrderId")]
public string WechatOrderId { get; set; } = string.Empty;
[JsonPropertyName("items")]
public List<TicketMessageDto> Items { get; set; } = [];
[JsonPropertyName("hasMore")]
public bool HasMore { get; set; }
[JsonPropertyName("nextBefore")]
public string? NextBefore { get; set; }
[JsonPropertyName("identityVerified")]
public bool IdentityVerified { get; set; }
}
public sealed class TicketMessageDto
{
[JsonPropertyName("messageId")]
public string MessageId { get; set; } = string.Empty;
[JsonPropertyName("sequenceNo")]
public int SequenceNo { get; set; }
[JsonPropertyName("senderType")]
public string SenderType { get; set; } = string.Empty;
[JsonPropertyName("senderName")]
public string SenderName { get; set; } = string.Empty;
[JsonPropertyName("text")]
public string Text { get; set; } = string.Empty;
[JsonPropertyName("recalled")]
public bool Recalled { get; set; }
[JsonPropertyName("createdAt")]
public string CreatedAt { get; set; } = string.Empty;
}
public sealed class CreateWorkOrderResponse
{
[JsonPropertyName("success")]
public bool Success { get; set; } = true;
[JsonPropertyName("operation")]
public string Operation { get; set; } = string.Empty;
[JsonPropertyName("appId")]
public string AppId { get; set; } = string.Empty;
[JsonPropertyName("wechatOrderId")]
public string WechatOrderId { get; set; } = string.Empty;
[JsonPropertyName("status")]
public string Status { get; set; } = string.Empty;
[JsonPropertyName("messageId")]
public string? MessageId { get; set; }
[JsonPropertyName("version")]
public string Version { get; set; } = string.Empty;
[JsonPropertyName("replayed")]
public bool Replayed { get; set; }
[JsonPropertyName("identityVerified")]
public bool IdentityVerified { get; set; }
}
public sealed class SendMessageResponse
{
[JsonPropertyName("success")]
public bool Success { get; set; } = true;
[JsonPropertyName("appId")]
public string AppId { get; set; } = string.Empty;
[JsonPropertyName("wechatOrderId")]
public string WechatOrderId { get; set; } = string.Empty;
[JsonPropertyName("message")]
public TicketMessageDto? Message { get; set; }
[JsonPropertyName("status")]
public string Status { get; set; } = string.Empty;
[JsonPropertyName("version")]
public string Version { get; set; } = string.Empty;
[JsonPropertyName("reopened")]
public bool Reopened { get; set; }
[JsonPropertyName("replayed")]
public bool Replayed { get; set; }
[JsonPropertyName("identityVerified")]
public bool IdentityVerified { get; set; }
}
public sealed class ApiSuccessResponse
{
[JsonPropertyName("success")]
public bool Success { get; set; } = true;
}
public sealed class ApiErrorResponse
{
[JsonPropertyName("success")]
public bool Success { get; set; }
[JsonPropertyName("message")]
public string Message { get; set; } = string.Empty;
[JsonPropertyName("error")]
public string Error { get; set; } = string.Empty;
[JsonPropertyName("code")]
public string Code { get; set; } = string.Empty;
}
public sealed class TestSupportReplyRequest
{
[Required]
[JsonPropertyName("purchaseAccount")]
public string? PurchaseAccount { get; set; }
[Required]
[JsonPropertyName("appId")]
public string? AppId { get; set; }
[Required]
[JsonPropertyName("wechatOrderId")]
public string? WechatOrderId { get; set; }
[Required]
[JsonPropertyName("text")]
public string? Text { get; set; }
[JsonPropertyName("senderName")]
public string? SenderName { get; set; }
public TestSupportReplyRequest()
{
PurchaseAccount = "18990991234";
SenderName = "丽丽";
}
}
public sealed class TestCompleteTicketRequest
{
[Required]
[JsonPropertyName("purchaseAccount")]
public string? PurchaseAccount { get; set; }
[Required]
[JsonPropertyName("appId")]
public string? AppId { get; set; }
[Required]
[JsonPropertyName("wechatOrderId")]
public string? WechatOrderId { get; set; }
}
public sealed class TestSupportReplyResponse
{
[JsonPropertyName("success")]
public bool Success { get; set; } = true;
[JsonPropertyName("message")]
public TicketMessageDto? Message { get; set; }
[JsonPropertyName("status")]
public string Status { get; set; } = string.Empty;
[JsonPropertyName("version")]
public string Version { get; set; } = string.Empty;
}
public sealed class TestStateResponse
{
[JsonPropertyName("success")]
public bool Success { get; set; } = true;
[JsonPropertyName("orders")]
public List<TestWorkOrderStateDto> Orders { get; set; } = [];
[JsonPropertyName("sseSubscribers")]
public int SseSubscribers { get; set; }
}
public sealed class TestWorkOrderStateDto
{
[JsonPropertyName("purchaseAccount")]
public string PurchaseAccount { get; set; } = string.Empty;
[JsonPropertyName("appId")]
public string AppId { get; set; } = string.Empty;
[JsonPropertyName("wechatOrderId")]
public string WechatOrderId { get; set; } = string.Empty;
[JsonPropertyName("status")]
public string Status { get; set; } = string.Empty;
[JsonPropertyName("version")]
public string Version { get; set; } = string.Empty;
[JsonPropertyName("readThroughSequenceNo")]
public int ReadThroughSequenceNo { get; set; }
[JsonPropertyName("messages")]
public List<TicketMessageDto> Messages { get; set; } = [];
}
public sealed class TicketRealtimeNotificationDto
{
[JsonPropertyName("eventId")]
public string EventId { get; set; } = string.Empty;
[JsonPropertyName("type")]
public string Type { get; set; } = string.Empty;
[JsonPropertyName("appId")]
public string AppId { get; set; } = string.Empty;
[JsonPropertyName("wechatOrderId")]
public string WechatOrderId { get; set; } = string.Empty;
[JsonPropertyName("messageId")]
public string? MessageId { get; set; }
[JsonPropertyName("version")]
public string Version { get; set; } = string.Empty;
[JsonPropertyName("occurredAt")]
public string OccurredAt { get; set; } = string.Empty;
}