TaskTemplateDto.cs 3.88 KB
using System.ComponentModel.DataAnnotations;
using Rcs.Application.DTOs;
using Rcs.Domain.Entities;
using Rcs.Domain.Enums;

namespace Rcs.Application.Dtos
{
    public class TaskTemplateListItemDto
    {
        public string TemplateId { get; set; } = string.Empty;
        public string TemplateCode { get; set; } = string.Empty;
        public string TemplateName { get; set; } = string.Empty;
        public string? Description { get; set; }
        public int RobotType { get; set; }
        public string? Manufacturer { get; set; }
        public bool IsEnabled { get; set; }
        /// <summary>
        /// 是否为默认模板
        /// @author zzy
        /// </summary>
        public bool IsDefault { get; set; }
        public DateTime? CreatedAt { get; set; }
    }

    public class TaskTemplateDto : TaskTemplateListItemDto
    {
        public List<TaskStepDto> TaskSteps { get; set; } = new List<TaskStepDto>();
    }

    public class TaskStepDto
    {
        public string StepId { get; set; } = string.Empty;
        public string TemplateId { get; set; } = string.Empty;
        public int Type { get; set; }
        public string? StepName { get; set; }
        public string? Description { get; set; }
        public int Order { get; set; }
        public DateTime? CreatedAt { get; set; }
        public List<StepPropertyDto> Properties { get; set; } = new List<StepPropertyDto>();
    }

    public class StepPropertyDto
    {
        public string PropertyId { get; set; } = string.Empty;
        public string StepId { get; set; } = string.Empty;
        public int PropertyType { get; set; }
        public int NodeValue { get; set; }
        public List<ActionDto> Actions { get; set; } = new List<ActionDto>();

        /// <summary>
        /// 前置动作类型1
        /// </summary>
        public int? PreAction1Type { get; set; }

        /// <summary>
        /// 前置网络动作集合1
        /// </summary>
        public List<string>? PreNetActions1 { get; set; }

        /// <summary>
        /// 后置动作类型1
        /// </summary>
        public int? PostAction1Type { get; set; }

        /// <summary>
        /// 后置网络动作集合1
        /// </summary>
        public List<string>? PostNetActions1 { get; set; }

        /// <summary>
        /// 前置动作类型2
        /// </summary>
        public int? PreAction2Type { get; set; }

        /// <summary>
        /// 前置网络动作集合2
        /// </summary>
        public List<string>? PreNetActions2 { get; set; }

        /// <summary>
        /// 后置动作类型2
        /// </summary>
        public int? PostAction2Type { get; set; }

        /// <summary>
        /// 后置网络动作集合2
        /// </summary>
        public List<string>? PostNetActions2 { get; set; }
    }

    /// <summary>
    /// 步骤属性动作配置DTO(后置动作如HTTP请求等)
    /// @author zzy
    /// </summary>
    public class NetActionPropertyDto
    {
        public string ActionConfigId { get; set; } = string.Empty;
        public string? RequestMethod { get; set; }
        public string? RequestUrl { get; set; }
        public string? RequestParams { get; set; }
        public int? RepeatCount { get; set; }
        public int? IntervalTimeMs { get; set; }
        public string? WaitResponseFlag { get; set; }
        public string? ResponseValidationRule { get; set; }
        public string? Description { get; set; }
        public string? ExtraProperties { get; set; }
    }

    public class ActionDto
    {
        public string ActionId { get; set; } = string.Empty;
        public string PropertyId { get; set; } = string.Empty;
        public string Type { get; set; } = string.Empty;
        public string? StepName { get; set; }
        public string? Description { get; set; }
        public int BlockingType { get; set; } = (int)ActionBlockType.Hard;
        public int Order { get; set; }
    }
}