
package cn.orionsec.ops.entity.importer;

import cn.orionsec.kit.lang.utils.convert.TypeStore;
import cn.orionsec.kit.office.excel.annotation.ImportField;
import cn.orionsec.ops.entity.domain.CommandTemplateDO;
import cn.orionsec.ops.entity.vo.data.DataImportCheckRowVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;


@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "命令模板导入")
public class CommandTemplateImportDTO extends BaseDataImportDTO {

    @ApiModelProperty(value = "模板名称")
    @ImportField(index = 0)
    private String name;

    @ApiModelProperty(value = "模板命令")
    @ImportField(index = 1)
    private String template;

    @ApiModelProperty(value = "描述")
    @ImportField(index = 2)
    private String description;

    static {
        TypeStore.STORE.register(CommandTemplateImportDTO.class, DataImportCheckRowVO.class, p -> {
            DataImportCheckRowVO vo = new DataImportCheckRowVO();
            vo.setSymbol(p.name);
            vo.setIllegalMessage(p.getIllegalMessage());
            vo.setId(p.getId());
            return vo;
        });
        TypeStore.STORE.register(CommandTemplateImportDTO.class, CommandTemplateDO.class, p -> {
            CommandTemplateDO d = new CommandTemplateDO();
            d.setId(p.getId());
            d.setTemplateName(p.name);
            d.setTemplateValue(p.template);
            d.setDescription(p.description);
            return d;
        });
    }

}
