namespace TakeoutSaaS.TenantApi.Contracts.Store;

/// <summary>
/// 分页结构。
/// </summary>
public sealed class PaginatedResultDto<T>
{
    /// <summary>
    /// Items。
    /// </summary>
    public List<T> Items { get; set; } = [];
    /// <summary>
    /// Total。
    /// </summary>
    public int Total { get; set; }
    /// <summary>
    /// Page。
    /// </summary>
    public int Page { get; set; }
    /// <summary>
    /// PageSize。
    /// </summary>
    public int PageSize { get; set; }
}

/// <summary>
/// 员工档案。
/// </summary>
public sealed class StoreStaffItemDto
{
    /// <summary>
    /// Id。
    /// </summary>
    public string Id { get; set; } = string.Empty;
    /// <summary>
    /// Name。
    /// </summary>
    public string Name { get; set; } = string.Empty;
    /// <summary>
    /// Phone。
    /// </summary>
    public string Phone { get; set; } = string.Empty;
    /// <summary>
    /// Email。
    /// </summary>
    public string Email { get; set; } = string.Empty;
    /// <summary>
    /// RoleType。
    /// </summary>
    public string RoleType { get; set; } = "cashier";
    /// <summary>
    /// Status。
    /// </summary>
    public string Status { get; set; } = "active";
    /// <summary>
    /// Permissions。
    /// </summary>
    public List<string> Permissions { get; set; } = [];
    /// <summary>
    /// AvatarColor。
    /// </summary>
    public string AvatarColor { get; set; } = "#1677ff";
    /// <summary>
    /// HiredAt。
    /// </summary>
    public string HiredAt { get; set; } = string.Empty;
}

/// <summary>
/// 班次时间段模板。
/// </summary>
public sealed class ShiftTemplateItemDto
{
    /// <summary>
    /// StartTime。
    /// </summary>
    public string StartTime { get; set; } = string.Empty;
    /// <summary>
    /// EndTime。
    /// </summary>
    public string EndTime { get; set; } = string.Empty;
}

/// <summary>
/// 门店班次模板。
/// </summary>
public sealed class StoreShiftTemplatesDto
{
    /// <summary>
    /// Morning。
    /// </summary>
    public ShiftTemplateItemDto Morning { get; set; } = new();
    /// <summary>
    /// Evening。
    /// </summary>
    public ShiftTemplateItemDto Evening { get; set; } = new();
    /// <summary>
    /// Full。
    /// </summary>
    public ShiftTemplateItemDto Full { get; set; } = new();
}

/// <summary>
/// 员工单日排班。
/// </summary>
public sealed class StaffDayShiftDto
{
    /// <summary>
    /// DayOfWeek。
    /// </summary>
    public int DayOfWeek { get; set; }
    /// <summary>
    /// ShiftType。
    /// </summary>
    public string ShiftType { get; set; } = "off";
    /// <summary>
    /// StartTime。
    /// </summary>
    public string StartTime { get; set; } = string.Empty;
    /// <summary>
    /// EndTime。
    /// </summary>
    public string EndTime { get; set; } = string.Empty;
}

/// <summary>
/// 员工排班。
/// </summary>
public sealed class StaffScheduleDto
{
    /// <summary>
    /// StaffId。
    /// </summary>
    public string StaffId { get; set; } = string.Empty;
    /// <summary>
    /// Shifts。
    /// </summary>
    public List<StaffDayShiftDto> Shifts { get; set; } = [];
}

/// <summary>
/// 门店排班聚合。
/// </summary>
public sealed class StoreStaffScheduleDto
{
    /// <summary>
    /// StoreId。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
    /// <summary>
    /// WeekStartDate。
    /// </summary>
    public string WeekStartDate { get; set; } = string.Empty;
    /// <summary>
    /// Templates。
    /// </summary>
    public StoreShiftTemplatesDto? Templates { get; set; }
    /// <summary>
    /// IsTemplateConfigured。
    /// </summary>
    public bool IsTemplateConfigured { get; set; }
    /// <summary>
    /// IsScheduleConfigured。
    /// </summary>
    public bool IsScheduleConfigured { get; set; }
    /// <summary>
    /// Schedules。
    /// </summary>
    public List<StaffScheduleDto> Schedules { get; set; } = [];
}

/// <summary>
/// 保存员工请求。
/// </summary>
public sealed class SaveStoreStaffRequest
{
    /// <summary>
    /// StoreId。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
    /// <summary>
    /// Id。
    /// </summary>
    public string? Id { get; set; }
    /// <summary>
    /// Name。
    /// </summary>
    public string Name { get; set; } = string.Empty;
    /// <summary>
    /// Phone。
    /// </summary>
    public string Phone { get; set; } = string.Empty;
    /// <summary>
    /// Email。
    /// </summary>
    public string Email { get; set; } = string.Empty;
    /// <summary>
    /// RoleType。
    /// </summary>
    public string RoleType { get; set; } = "cashier";
    /// <summary>
    /// Status。
    /// </summary>
    public string Status { get; set; } = "active";
    /// <summary>
    /// Permissions。
    /// </summary>
    public List<string> Permissions { get; set; } = [];
}

/// <summary>
/// 删除员工请求。
/// </summary>
public sealed class DeleteStoreStaffRequest
{
    /// <summary>
    /// StoreId。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
    /// <summary>
    /// StaffId。
    /// </summary>
    public string StaffId { get; set; } = string.Empty;
}

/// <summary>
/// 保存班次模板请求。
/// </summary>
public sealed class SaveStoreStaffTemplatesRequest
{
    /// <summary>
    /// StoreId。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
    /// <summary>
    /// Templates。
    /// </summary>
    public StoreShiftTemplatesDto Templates { get; set; } = new();
}

/// <summary>
/// 保存个人排班请求。
/// </summary>
public sealed class SaveStoreStaffPersonalScheduleRequest
{
    /// <summary>
    /// StoreId。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
    /// <summary>
    /// StaffId。
    /// </summary>
    public string StaffId { get; set; } = string.Empty;
    /// <summary>
    /// Shifts。
    /// </summary>
    public List<StaffDayShiftDto> Shifts { get; set; } = [];
}

/// <summary>
/// 保存周排班请求。
/// </summary>
public sealed class SaveStoreStaffWeeklyScheduleRequest
{
    /// <summary>
    /// StoreId。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
    /// <summary>
    /// Schedules。
    /// </summary>
    public List<StaffScheduleDto> Schedules { get; set; } = [];
}

/// <summary>
/// 复制排班请求。
/// </summary>
public sealed class CopyStoreStaffScheduleRequest
{
    /// <summary>
    /// SourceStoreId。
    /// </summary>
    public string SourceStoreId { get; set; } = string.Empty;
    /// <summary>
    /// TargetStoreIds。
    /// </summary>
    public List<string> TargetStoreIds { get; set; } = [];
    /// <summary>
    /// CopyScope。
    /// </summary>
    public string CopyScope { get; set; } = string.Empty;
}

/// <summary>
/// 复制排班结果。
/// </summary>
public sealed class CopyStoreStaffScheduleResult
{
    /// <summary>
    /// CopiedCount。
    /// </summary>
    public int CopiedCount { get; set; }
    /// <summary>
    /// CopyScope。
    /// </summary>
    public string CopyScope { get; set; } = "template_and_schedule";
}
