TaskTemplateDto.cs 2.63 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 int AfterActionType { get; set; }
        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 List<ActionDto> Actions { get; set; } = new List<ActionDto>();
    }

    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; }
    }
}