package cn.reghao.devops.mgr.app.model.po.log;

import cn.reghao.devops.mgr.builder.model.BuildConsumedDto;
import lombok.*;

import javax.persistence.Embeddable;

/**
 * 构建各阶段耗费的时间
 *
 * @author reghao
 * @date 2021-05-21 16:42:38
 */
@NoArgsConstructor
@Setter
@Getter
@Embeddable
public class BuildConsumed {
    private Long pullConsumed;
    private Long compileConsumed;
    private Long packConsumed;
    private Long pushConsumed;
    // 单位 second
    private Long total;

    public BuildConsumed(BuildConsumedDto buildConsumedDto) {
        this.pullConsumed = buildConsumedDto.getPullConsumed();
        this.compileConsumed = buildConsumedDto.getCompileConsumed();
        this.packConsumed = buildConsumedDto.getPackConsumed();
        this.pushConsumed = buildConsumedDto.getPushConsumed();
        this.total = (this.pullConsumed + this.compileConsumed + this.packConsumed + this.pushConsumed)/1000;
    }
}
