using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using NPP.SmartSchedue.Api.Contracts.Core.Enums;

namespace NPP.SmartSchedue.Api.Contracts.Services.Time.Input;

/// <summary>
/// 批量单元格编辑操作输入模型
/// 用于批量修改班次不可用标记的复杂操作
/// </summary>
public class BatchCellEditInput
{
    /// <summary>
    /// 单元格操作列表
    /// </summary>
    [Required(ErrorMessage = "单元格操作列表不能为空")]
    [MinLength(1, ErrorMessage = "至少需要指定一个操作")]
    public List<BatchCellOperation> CellOperations { get; set; } = new();

    /// <summary>
    /// 是否标记为模板生成
    /// </summary>
    public bool MarkAsTemplate { get; set; } = false;

    /// <summary>
    /// 操作备注
    /// </summary>
    [StringLength(200, ErrorMessage = "备注长度不能超过200字符")]
    public string Remark { get; set; }
}

/// <summary>
/// 单个单元格操作定义
/// 包含操作类型和目标信息
/// </summary>
public class BatchCellOperation
{
    /// <summary>
    /// 操作类型
    /// </summary>
    [Required(ErrorMessage = "操作类型不能为空")]
    public BatchCellOperationType Operation { get; set; }

    /// <summary>
    /// 员工ID
    /// </summary>
    [Required(ErrorMessage = "员工ID不能为空")]
    public long PersonnelId { get; set; }

    /// <summary>
    /// 日期
    /// </summary>
    [Required(ErrorMessage = "日期不能为空")]
    public DateTime Date { get; set; }

    /// <summary>
    /// 班次ID
    /// </summary>
    [Required(ErrorMessage = "班次ID不能为空")]
    public long ShiftId { get; set; }

    /// <summary>
    /// 不可用原因类型（Set操作时必填）
    /// </summary>
    public UnavailabilityReasonType? ReasonType { get; set; }

    /// <summary>
    /// 备注说明
    /// </summary>
    [StringLength(200, ErrorMessage = "备注长度不能超过200字符")]
    public string Remark { get; set; }

    /// <summary>
    /// 优先级权重
    /// </summary>
    [Range(1, 100, ErrorMessage = "优先级权重必须在1-100之间")]
    public int? Priority { get; set; }

    /// <summary>
    /// 生效开始时间
    /// </summary>
    public DateTime? EffectiveStartTime { get; set; }

    /// <summary>
    /// 生效结束时间
    /// </summary>
    public DateTime? EffectiveEndTime { get; set; }
}