package net.northking.cctp.se.log.bean;

import lombok.Data;
import org.springframework.boot.logging.LogLevel;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * 步骤执行日志
 */
@Data
public class StepLog {

    private String stepId;

    private Date time;

    private String level;

    private String title;

    private String cmpt;

    private String cmptName;

    private String stepType;

    private String log;

    private String logType = LogType.TEXT.name(); // text, image

    private List<String> resources = new ArrayList<>();

    public StepLog(String level, String title, String stepType, String cmpt) {
        this.time = new Date();
        if (StringUtils.isEmpty(level)) {
            level = LogLevel.INFO.name();
        }
        this.level = level;
        this.title = title;
        this.stepType = stepType;
        this.cmpt = cmpt;
    }

    public static enum LogType {
        TEXT, IMAGE
    }
}
