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

namespace TakeoutSaaS.Domain.Deliveries.Entities;

/// <summary>
/// 配送单。
/// </summary>
public sealed class DeliveryOrder : MultiTenantEntityBase
{
    /// <summary>
    /// 获取或设置关联订单 ID。
    /// </summary>
    public long OrderId { get; set; }

    /// <summary>
    /// 配送服务商。
    /// </summary>
    public DeliveryProvider Provider { get; set; } = DeliveryProvider.InHouse;

    /// <summary>
    /// 第三方配送单号。
    /// </summary>
    public string? ProviderOrderId { get; set; }

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

    /// <summary>
    /// 配送费。
    /// </summary>
    public decimal? DeliveryFee { get; set; }

    /// <summary>
    /// 骑手姓名。
    /// </summary>
    public string? CourierName { get; set; }

    /// <summary>
    /// 骑手电话。
    /// </summary>
    public string? CourierPhone { get; set; }

    /// <summary>
    /// 下发时间。
    /// </summary>
    public DateTime? DispatchedAt { get; set; }

    /// <summary>
    /// 取餐时间。
    /// </summary>
    public DateTime? PickedUpAt { get; set; }

    /// <summary>
    /// 完成时间。
    /// </summary>
    public DateTime? DeliveredAt { get; set; }

    /// <summary>
    /// 异常原因。
    /// </summary>
    public string? FailureReason { get; set; }
}
