using System.Text.Json.Serialization;
using TakeoutSaaS.Domain.Tenants.Enums;
using TakeoutSaaS.Shared.Abstractions.Serialization;
namespace TakeoutSaaS.Application.App.Billings.Dto;
///
/// 账单详情 DTO(租户端)。
///
public sealed record BillingDetailDto
{
///
/// 账单 ID。
///
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
public long Id { get; init; }
///
/// 租户 ID。
///
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
public long TenantId { get; init; }
///
/// 租户名称。
///
public string TenantName { get; init; } = string.Empty;
///
/// 账单编号。
///
public string StatementNo { get; init; } = string.Empty;
///
/// 计费周期开始时间(UTC)。
///
public DateTime PeriodStart { get; init; }
///
/// 计费周期结束时间(UTC)。
///
public DateTime PeriodEnd { get; init; }
///
/// 账单类型。
///
public BillingType BillingType { get; init; }
///
/// 账单状态。
///
public TenantBillingStatus Status { get; init; }
///
/// 应付金额。
///
public decimal AmountDue { get; init; }
///
/// 已支付金额。
///
public decimal AmountPaid { get; init; }
///
/// 折扣金额。
///
public decimal DiscountAmount { get; init; }
///
/// 税费金额。
///
public decimal TaxAmount { get; init; }
///
/// 总金额(应付金额 - 折扣 + 税费)。
///
public decimal TotalAmount { get; init; }
///
/// 币种。
///
public string Currency { get; init; } = "CNY";
///
/// 到期日。
///
public DateTime DueDate { get; init; }
///
/// 订阅 ID(可选)。
///
[JsonConverter(typeof(NullableSnowflakeIdJsonConverter))]
public long? SubscriptionId { get; init; }
///
/// 账单明细 JSON(原始字符串)。
///
public string? LineItemsJson { get; init; }
///
/// 账单明细行项目。
///
public IReadOnlyList LineItems { get; init; } = [];
///
/// 支付记录。
///
public IReadOnlyList Payments { get; init; } = [];
///
/// 提醒发送时间。
///
public DateTime? ReminderSentAt { get; init; }
///
/// 逾期通知时间。
///
public DateTime? OverdueNotifiedAt { get; init; }
///
/// 备注。
///
public string? Notes { get; init; }
///
/// 创建时间。
///
public DateTime CreatedAt { get; init; }
///
/// 创建人 ID。
///
[JsonConverter(typeof(NullableSnowflakeIdJsonConverter))]
public long? CreatedBy { get; init; }
///
/// 更新时间。
///
public DateTime? UpdatedAt { get; init; }
///
/// 更新人 ID。
///
[JsonConverter(typeof(NullableSnowflakeIdJsonConverter))]
public long? UpdatedBy { get; init; }
}