using TakeoutSaaS.Domain.Tenants.Enums;
using TakeoutSaaS.Shared.Abstractions.Entities;

namespace TakeoutSaaS.Domain.Tenants.Entities;

/// <summary>
/// 租户发票记录。
/// </summary>
public sealed class TenantInvoiceRecord : MultiTenantEntityBase
{
    /// <summary>
    /// 发票号码。
    /// </summary>
    public string InvoiceNo { get; set; } = string.Empty;

    /// <summary>
    /// 申请人。
    /// </summary>
    public string ApplicantName { get; set; } = string.Empty;

    /// <summary>
    /// 开票抬头（公司名）。
    /// </summary>
    public string CompanyName { get; set; } = string.Empty;

    /// <summary>
    /// 纳税人识别号快照。
    /// </summary>
    public string? TaxpayerNumber { get; set; }

    /// <summary>
    /// 发票类型。
    /// </summary>
    public TenantInvoiceType InvoiceType { get; set; } = TenantInvoiceType.Normal;

    /// <summary>
    /// 开票金额。
    /// </summary>
    public decimal Amount { get; set; }

    /// <summary>
    /// 关联订单号。
    /// </summary>
    public string OrderNo { get; set; } = string.Empty;

    /// <summary>
    /// 接收邮箱。
    /// </summary>
    public string? ContactEmail { get; set; }

    /// <summary>
    /// 联系电话。
    /// </summary>
    public string? ContactPhone { get; set; }

    /// <summary>
    /// 申请备注。
    /// </summary>
    public string? ApplyRemark { get; set; }

    /// <summary>
    /// 发票状态。
    /// </summary>
    public TenantInvoiceStatus Status { get; set; } = TenantInvoiceStatus.Pending;

    /// <summary>
    /// 申请时间（UTC）。
    /// </summary>
    public DateTime AppliedAt { get; set; } = DateTime.UtcNow;

    /// <summary>
    /// 开票时间（UTC）。
    /// </summary>
    public DateTime? IssuedAt { get; set; }

    /// <summary>
    /// 开票人 ID。
    /// </summary>
    public long? IssuedByUserId { get; set; }

    /// <summary>
    /// 开票备注。
    /// </summary>
    public string? IssueRemark { get; set; }

    /// <summary>
    /// 作废时间（UTC）。
    /// </summary>
    public DateTime? VoidedAt { get; set; }

    /// <summary>
    /// 作废人 ID。
    /// </summary>
    public long? VoidedByUserId { get; set; }

    /// <summary>
    /// 作废原因。
    /// </summary>
    public string? VoidReason { get; set; }
}
