using System;
using System.Collections.Generic;

namespace NPP.SmartSchedue.Api.Contracts.Services.Workbench.Output;

/// <summary>
/// 用户本周日历数据输出
/// </summary>
public class WeeklyCalendarOutput
{
    /// <summary>
    /// 周开始日期（周一）
    /// </summary>
    public DateTime WeekStartDate { get; set; }
    
    /// <summary>
    /// 周结束日期（周日）
    /// </summary>
    public DateTime WeekEndDate { get; set; }
    
    /// <summary>
    /// 人员ID
    /// </summary>
    public long PersonnelId { get; set; }
    
    /// <summary>
    /// 人员姓名
    /// </summary>
    public string PersonnelName { get; set; }
    
    /// <summary>
    /// 每日日历数据
    /// </summary>
    public List<CalendarDayItem> Days { get; set; } = new List<CalendarDayItem>();
}

/// <summary>
/// 单日日历数据项
/// </summary>
public class CalendarDayItem
{
    /// <summary>
    /// 日期
    /// </summary>
    public DateTime Date { get; set; }
    
    /// <summary>
    /// 星期几（1=周一，7=周日）
    /// </summary>
    public int DayOfWeek { get; set; }
    
    /// <summary>
    /// 星期几中文名称
    /// </summary>
    public string DayOfWeekName { get; set; }
    
    /// <summary>
    /// 该日的班次数据
    /// </summary>
    public List<CalendarShiftItem> Shifts { get; set; } = new List<CalendarShiftItem>();
}

/// <summary>
/// 班次日历数据项
/// </summary>
public class CalendarShiftItem
{
    /// <summary>
    /// 班次ID
    /// </summary>
    public long ShiftId { get; set; }
    
    /// <summary>
    /// 班次名称
    /// </summary>
    public string ShiftName { get; set; }
    
    /// <summary>
    /// 班次开始时间
    /// </summary>
    public TimeSpan StartTime { get; set; }
    
    /// <summary>
    /// 班次结束时间
    /// </summary>
    public TimeSpan EndTime { get; set; }
    
    /// <summary>
    /// 该班次的工作任务
    /// </summary>
    public List<CalendarTaskItem> Tasks { get; set; } = new List<CalendarTaskItem>();
    
    /// <summary>
    /// 该班次的不可用时间段
    /// </summary>
    public List<CalendarUnavailableItem> UnavailableItems { get; set; } = new List<CalendarUnavailableItem>();
}

/// <summary>
/// 任务日历项
/// </summary>
public class CalendarTaskItem
{
    /// <summary>
    /// 任务ID
    /// </summary>
    public long TaskId { get; set; }
    
    /// <summary>
    /// 任务代码
    /// </summary>
    public string TaskCode { get; set; }
    
    /// <summary>
    /// 项目号
    /// </summary>
    public string ProjectNumber { get; set; }
    
    /// <summary>
    /// 工序名称
    /// </summary>
    public string ProcessName { get; set; }
    
    /// <summary>
    /// 任务状态
    /// </summary>
    public int Status { get; set; }
    
    /// <summary>
    /// 状态名称
    /// </summary>
    public string StatusName { get; set; }
    
    /// <summary>
    /// 优先级
    /// </summary>
    public int Priority { get; set; }
    
    /// <summary>
    /// 预计工时
    /// </summary>
    public decimal? EstimatedHours { get; set; }
    
    /// <summary>
    /// 计划开始时间
    /// </summary>
    public DateTime PlannedStartTime { get; set; }
    
    /// <summary>
    /// 计划结束时间
    /// </summary>
    public DateTime PlannedEndTime { get; set; }
    
    /// <summary>
    /// 备注
    /// </summary>
    public string Remarks { get; set; }
}

/// <summary>
/// 不可用时间段项
/// </summary>
public class CalendarUnavailableItem
{
    /// <summary>
    /// 不可用记录ID
    /// </summary>
    public long UnavailabilityId { get; set; }
    
    /// <summary>
    /// 不可用原因类型
    /// </summary>
    public int ReasonType { get; set; }
    
    /// <summary>
    /// 原因类型名称
    /// </summary>
    public string ReasonTypeName { get; set; }
    
    /// <summary>
    /// 备注说明
    /// </summary>
    public string Remark { get; set; }
    
    /// <summary>
    /// 生效开始时间（可选）
    /// </summary>
    public TimeSpan? EffectiveStartTime { get; set; }
    
    /// <summary>
    /// 生效结束时间（可选）
    /// </summary>
    public TimeSpan? EffectiveEndTime { get; set; }
    
    /// <summary>
    /// 优先级权重
    /// </summary>
    public int Priority { get; set; }
}