namespace TakeoutSaaS.TenantApi.Contracts.Store;

/// <summary>
/// 自提基础设置。
/// </summary>
public sealed class PickupBasicSettingsDto
{
    /// <summary>
    /// AllowSameDayPickup。
    /// </summary>
    public bool AllowSameDayPickup { get; set; }
    /// <summary>
    /// BookingDays。
    /// </summary>
    public int BookingDays { get; set; }
    /// <summary>
    /// MaxItemsPerOrder。
    /// </summary>
    public int? MaxItemsPerOrder { get; set; }
}

/// <summary>
/// 自提大时段。
/// </summary>
public sealed class PickupSlotDto
{
    /// <summary>
    /// Id。
    /// </summary>
    public string Id { get; set; } = string.Empty;
    /// <summary>
    /// Name。
    /// </summary>
    public string Name { get; set; } = string.Empty;
    /// <summary>
    /// StartTime。
    /// </summary>
    public string StartTime { get; set; } = string.Empty;
    /// <summary>
    /// EndTime。
    /// </summary>
    public string EndTime { get; set; } = string.Empty;
    /// <summary>
    /// CutoffMinutes。
    /// </summary>
    public int CutoffMinutes { get; set; }
    /// <summary>
    /// Capacity。
    /// </summary>
    public int Capacity { get; set; }
    /// <summary>
    /// ReservedCount。
    /// </summary>
    public int ReservedCount { get; set; }
    /// <summary>
    /// DayOfWeeks。
    /// </summary>
    public List<int> DayOfWeeks { get; set; } = [];
    /// <summary>
    /// Enabled。
    /// </summary>
    public bool Enabled { get; set; }
}

/// <summary>
/// 精细规则。
/// </summary>
public sealed class PickupFineRuleDto
{
    /// <summary>
    /// IntervalMinutes。
    /// </summary>
    public int IntervalMinutes { get; set; }
    /// <summary>
    /// SlotCapacity。
    /// </summary>
    public int SlotCapacity { get; set; }
    /// <summary>
    /// DayStartTime。
    /// </summary>
    public string DayStartTime { get; set; } = string.Empty;
    /// <summary>
    /// DayEndTime。
    /// </summary>
    public string DayEndTime { get; set; } = string.Empty;
    /// <summary>
    /// MinAdvanceHours。
    /// </summary>
    public int MinAdvanceHours { get; set; }
    /// <summary>
    /// DayOfWeeks。
    /// </summary>
    public List<int> DayOfWeeks { get; set; } = [];
}

/// <summary>
/// 预览时段。
/// </summary>
public sealed class PickupPreviewSlotDto
{
    /// <summary>
    /// Time。
    /// </summary>
    public string Time { get; set; } = string.Empty;
    /// <summary>
    /// Status。
    /// </summary>
    public string Status { get; set; } = "available";
    /// <summary>
    /// RemainingCount。
    /// </summary>
    public int RemainingCount { get; set; }
}

/// <summary>
/// 预览日期。
/// </summary>
public sealed class PickupPreviewDayDto
{
    /// <summary>
    /// Date。
    /// </summary>
    public string Date { get; set; } = string.Empty;
    /// <summary>
    /// Label。
    /// </summary>
    public string Label { get; set; } = string.Empty;
    /// <summary>
    /// SubLabel。
    /// </summary>
    public string SubLabel { get; set; } = string.Empty;
    /// <summary>
    /// Slots。
    /// </summary>
    public List<PickupPreviewSlotDto> Slots { get; set; } = [];
}

/// <summary>
/// 门店自提设置。
/// </summary>
public sealed class StorePickupSettingsDto
{
    /// <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>
    /// BasicSettings。
    /// </summary>
    public PickupBasicSettingsDto? BasicSettings { get; set; }
    /// <summary>
    /// BigSlots。
    /// </summary>
    public List<PickupSlotDto> BigSlots { get; set; } = [];
    /// <summary>
    /// FineRule。
    /// </summary>
    public PickupFineRuleDto? FineRule { get; set; }
    /// <summary>
    /// PreviewDays。
    /// </summary>
    public List<PickupPreviewDayDto> PreviewDays { get; set; } = [];
}

/// <summary>
/// 保存基础设置请求。
/// </summary>
public sealed class SavePickupBasicSettingsRequest
{
    /// <summary>
    /// StoreId。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
    /// <summary>
    /// Mode。
    /// </summary>
    public string? Mode { get; set; }
    /// <summary>
    /// BasicSettings。
    /// </summary>
    public PickupBasicSettingsDto BasicSettings { get; set; } = new();
}

/// <summary>
/// 保存大时段请求。
/// </summary>
public sealed class SavePickupSlotsRequest
{
    /// <summary>
    /// StoreId。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
    /// <summary>
    /// Mode。
    /// </summary>
    public string? Mode { get; set; }
    /// <summary>
    /// Slots。
    /// </summary>
    public List<PickupSlotDto> Slots { get; set; } = [];
}

/// <summary>
/// 保存精细规则请求。
/// </summary>
public sealed class SavePickupFineRuleRequest
{
    /// <summary>
    /// StoreId。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
    /// <summary>
    /// Mode。
    /// </summary>
    public string? Mode { get; set; }
    /// <summary>
    /// FineRule。
    /// </summary>
    public PickupFineRuleDto FineRule { get; set; } = new();
}

/// <summary>
/// 保存自提模式请求。
/// </summary>
public sealed class SavePickupModeRequest
{
    /// <summary>
    /// StoreId。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
    /// <summary>
    /// Mode。
    /// </summary>
    public string Mode { get; set; } = string.Empty;
}

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

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