using Exam.Infrastructure.Extensions;
using Hotline.Orders;
using Hotline.Share.Enums.BatchTask;
using SqlSugar;
using XF.Domain.Repository;

namespace Hotline.BatchTask;

/// <summary>
/// 系统任务
/// </summary>
public class Apptask : CreationEntity
{
    /// <summary>
    /// 任务名称
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// 任务描述
    /// </summary>
    public string? Description { get; set; }

    /// <summary>
    /// 任务类型
    /// </summary>
    public ETaskType TaskType { get; set; }

    [Navigate(NavigateType.OneToMany, nameof(ApptaskItem.ApptaskId))]
    public List<ApptaskItem> ApptaskItems { get; set; }

    public void CreateName() => Name = $"{TaskType.GetDescription()}-{DateTime.Now:yyyyMMddHHmmssfff}";
}