namespace TakeoutSaaS.TenantApi.Contracts.Store;

/// <summary>
/// 时段类型。
/// </summary>
public enum StoreHourSlotType
{
    /// <summary>
    /// 营业时段。
    /// </summary>
    Business = 1,

    /// <summary>
    /// 配送时段。
    /// </summary>
    Delivery = 2,

    /// <summary>
    /// 自提时段。
    /// </summary>
    Pickup = 3
}

/// <summary>
/// 特殊日期类型。
/// </summary>
public enum StoreHolidayType
{
    /// <summary>
    /// 休息日。
    /// </summary>
    Closed = 1,

    /// <summary>
    /// 特殊营业日。
    /// </summary>
    Special = 2
}

/// <summary>
/// 时段 DTO。
/// </summary>
public sealed class StoreHourTimeSlotDto
{
    /// <summary>
    /// Id。
    /// </summary>
    public string Id { get; set; } = string.Empty;
    /// <summary>
    /// Type。
    /// </summary>
    public int Type { get; set; }
    /// <summary>
    /// StartTime。
    /// </summary>
    public string StartTime { get; set; } = string.Empty;
    /// <summary>
    /// EndTime。
    /// </summary>
    public string EndTime { get; set; } = string.Empty;
    /// <summary>
    /// Capacity。
    /// </summary>
    public int? Capacity { get; set; }
    /// <summary>
    /// Remark。
    /// </summary>
    public string? Remark { get; set; }
}

/// <summary>
/// 每日营业时间 DTO。
/// </summary>
public sealed class StoreHourDayHoursDto
{
    /// <summary>
    /// DayOfWeek。
    /// </summary>
    public int DayOfWeek { get; set; }
    /// <summary>
    /// IsOpen。
    /// </summary>
    public bool IsOpen { get; set; }
    /// <summary>
    /// Slots。
    /// </summary>
    public List<StoreHourTimeSlotDto> Slots { get; set; } = [];
}

/// <summary>
/// 特殊日期 DTO。
/// </summary>
public sealed class StoreHourHolidayDto
{
    /// <summary>
    /// Id。
    /// </summary>
    public string Id { get; set; } = string.Empty;
    /// <summary>
    /// StartDate。
    /// </summary>
    public string StartDate { get; set; } = string.Empty;
    /// <summary>
    /// EndDate。
    /// </summary>
    public string EndDate { get; set; } = string.Empty;
    /// <summary>
    /// Type。
    /// </summary>
    public int Type { get; set; }
    /// <summary>
    /// StartTime。
    /// </summary>
    public string? StartTime { get; set; }
    /// <summary>
    /// EndTime。
    /// </summary>
    public string? EndTime { get; set; }
    /// <summary>
    /// Reason。
    /// </summary>
    public string Reason { get; set; } = string.Empty;
    /// <summary>
    /// Remark。
    /// </summary>
    public string? Remark { get; set; }
}

/// <summary>
/// 门店营业时间聚合。
/// </summary>
public sealed class StoreHoursDto
{
    /// <summary>
    /// StoreId。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
    /// <summary>
    /// WeeklyHours。
    /// </summary>
    public List<StoreHourDayHoursDto> WeeklyHours { get; set; } = [];
    /// <summary>
    /// Holidays。
    /// </summary>
    public List<StoreHourHolidayDto> Holidays { get; set; } = [];
}

/// <summary>
/// 保存每周时段请求。
/// </summary>
public sealed class SaveWeeklyHoursRequest
{
    /// <summary>
    /// StoreId。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
    /// <summary>
    /// WeeklyHours。
    /// </summary>
    public List<StoreHourDayHoursDto> WeeklyHours { get; set; } = [];
}

/// <summary>
/// 保存特殊日期请求。
/// </summary>
public sealed class SaveHolidayRequest
{
    /// <summary>
    /// StoreId。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
    /// <summary>
    /// Holiday。
    /// </summary>
    public StoreHourHolidayDto Holiday { get; set; } = new();
}

/// <summary>
/// 删除特殊日期请求。
/// </summary>
public sealed class DeleteHolidayRequest
{
    /// <summary>
    /// Id。
    /// </summary>
    public string Id { get; set; } = string.Empty;
}

/// <summary>
/// 复制营业时间请求。
/// </summary>
public sealed class CopyStoreHoursRequest
{
    /// <summary>
    /// SourceStoreId。
    /// </summary>
    public string SourceStoreId { get; set; } = string.Empty;
    /// <summary>
    /// TargetStoreIds。
    /// </summary>
    public List<string> TargetStoreIds { get; set; } = [];
    /// <summary>
    /// IncludeWeeklyHours。
    /// </summary>
    public bool? IncludeWeeklyHours { get; set; }
    /// <summary>
    /// IncludeHolidays。
    /// </summary>
    public bool? IncludeHolidays { get; set; }
}

/// <summary>
/// 复制结果。
/// </summary>
public sealed class CopyStoreHoursResult
{
    /// <summary>
    /// CopiedCount。
    /// </summary>
    public int CopiedCount { get; set; }
    /// <summary>
    /// IncludeWeeklyHours。
    /// </summary>
    public bool IncludeWeeklyHours { get; set; }
    /// <summary>
    /// IncludeHolidays。
    /// </summary>
    public bool IncludeHolidays { get; set; }
}
