namespace TakeoutSaaS.TenantApi.Contracts.Store;

/// <summary>
/// 半径梯度。
/// </summary>
public sealed class RadiusTierDto
{
    /// <summary>
    /// Id。
    /// </summary>
    public string Id { get; set; } = string.Empty;
    /// <summary>
    /// MinDistance。
    /// </summary>
    public decimal MinDistance { get; set; }
    /// <summary>
    /// MaxDistance。
    /// </summary>
    public decimal MaxDistance { get; set; }
    /// <summary>
    /// DeliveryFee。
    /// </summary>
    public decimal DeliveryFee { get; set; }
    /// <summary>
    /// EtaMinutes。
    /// </summary>
    public int EtaMinutes { get; set; }
    /// <summary>
    /// MinOrderAmount。
    /// </summary>
    public decimal MinOrderAmount { get; set; }
    /// <summary>
    /// Color。
    /// </summary>
    public string Color { get; set; } = "#1677ff";
}

/// <summary>
/// 多边形区域。
/// </summary>
public sealed class PolygonZoneDto
{
    /// <summary>
    /// Id。
    /// </summary>
    public string Id { get; set; } = string.Empty;
    /// <summary>
    /// Name。
    /// </summary>
    public string Name { get; set; } = string.Empty;
    /// <summary>
    /// Color。
    /// </summary>
    public string Color { get; set; } = "#1677ff";
    /// <summary>
    /// DeliveryFee。
    /// </summary>
    public decimal DeliveryFee { get; set; }
    /// <summary>
    /// EtaMinutes。
    /// </summary>
    public int EtaMinutes { get; set; }
    /// <summary>
    /// MinOrderAmount。
    /// </summary>
    public decimal MinOrderAmount { get; set; }
    /// <summary>
    /// Priority。
    /// </summary>
    public int Priority { get; set; }
    /// <summary>
    /// PolygonGeoJson。
    /// </summary>
    public string PolygonGeoJson { get; set; } = string.Empty;
}

/// <summary>
/// 通用配送设置。
/// </summary>
public sealed class DeliveryGeneralSettingsDto
{
    /// <summary>
    /// EtaAdjustmentMinutes。
    /// </summary>
    public int EtaAdjustmentMinutes { get; set; }
    /// <summary>
    /// FreeDeliveryThreshold。
    /// </summary>
    public decimal? FreeDeliveryThreshold { get; set; }
    /// <summary>
    /// HourlyCapacityLimit。
    /// </summary>
    public int HourlyCapacityLimit { get; set; }
    /// <summary>
    /// MaxDeliveryDistance。
    /// </summary>
    public decimal MaxDeliveryDistance { get; set; }
}

/// <summary>
/// 门店配送设置聚合。
/// </summary>
public sealed class StoreDeliverySettingsDto
{
    /// <summary>
    /// StoreId。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
    /// <summary>
    /// IsConfigured。
    /// </summary>
    public bool IsConfigured { get; set; }
    /// <summary>
    /// Mode。
    /// </summary>
    public string? Mode { get; set; }
    /// <summary>
    /// RadiusCenterLatitude。
    /// </summary>
    public decimal? RadiusCenterLatitude { get; set; }
    /// <summary>
    /// RadiusCenterLongitude。
    /// </summary>
    public decimal? RadiusCenterLongitude { get; set; }
    /// <summary>
    /// RadiusTiers。
    /// </summary>
    public List<RadiusTierDto> RadiusTiers { get; set; } = [];
    /// <summary>
    /// PolygonZones。
    /// </summary>
    public List<PolygonZoneDto> PolygonZones { get; set; } = [];
    /// <summary>
    /// GeneralSettings。
    /// </summary>
    public DeliveryGeneralSettingsDto? GeneralSettings { get; set; }
}

/// <summary>
/// 复制配送设置请求。
/// </summary>
public sealed class CopyStoreDeliverySettingsRequest
{
    /// <summary>
    /// SourceStoreId。
    /// </summary>
    public string SourceStoreId { get; set; } = string.Empty;
    /// <summary>
    /// TargetStoreIds。
    /// </summary>
    public List<string> TargetStoreIds { get; set; } = [];
}

/// <summary>
/// 复制结果。
/// </summary>
public sealed class CopyStoreDeliverySettingsResult
{
    /// <summary>
    /// CopiedCount。
    /// </summary>
    public int CopiedCount { get; set; }
}
