package cn.reghao.bnt.web.devops.app.model.po.log;

import cn.reghao.bnt.web.devops.builder.model.BuildConsumedDto;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import jakarta.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;
    }
}
