package com.cool.store.vo.log;

import com.cool.store.entity.LineFollowLogDO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;

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

/**
 * @author zhangchenbiao
 * @FileName: LineFollowLogVO
 * @Description:跟进日志
 * @date 2024-03-27 14:50
 */
@Data
public class LineFollowLogVO {

    @ApiModelProperty("日志")
    private String message;

    @ApiModelProperty("创建时间")
    private Date createTime;

    public LineFollowLogVO(String message, Date createTime) {
        this.message = message;
        this.createTime = createTime;
    }

    public static List<LineFollowLogVO> convertList(List<LineFollowLogDO> list){
        if (CollectionUtils.isEmpty(list)) {
            return null;
        }
        List<LineFollowLogVO> resultList = new ArrayList<>();
        for (LineFollowLogDO followLog : list) {
            resultList.add(new LineFollowLogVO(followLog.getMessage(), followLog.getCreateTime()));
        }
        return resultList;
    }
}
