package com.qqchen.deploy.backend.deploy.integration.response;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;

/**
 * Jenkins构建响应对象
 */
@Data
public class JenkinsBuildResponse {
    /**
     * 构建编号
     */
    private Integer number;
    
    /**
     * 构建URL
     */
    private String url;
    
    /**
     * 构建类型
     */
    @JsonProperty("_class")
    private String buildClass;
    
    /**
     * 构建结果
     */
    private String result;
    
    /**
     * 构建时间戳
     */
    private Long timestamp;
    
    /**
     * 构建开始时间
     */
    private Long startTimeMillis;
    
    /**
     * 构建持续时间（毫秒）
     */
    private Long duration;
    
    /**
     * 预计持续时间
     */
    private Long estimatedDuration;
    
    /**
     * 是否正在构建
     */
    private Boolean building;
    
    /**
     * 构建描述
     */
    private String description;
    
    /**
     * 显示名称
     */
    private String displayName;
    
    /**
     * 完整显示名称
     */
    private String fullDisplayName;
    
    /**
     * 构建ID
     */
    private String id;
    
    /**
     * 保持永久
     */
    private Boolean keepLog;
    
    /**
     * 构建队列ID
     */
    private Long queueId;
    
    /**
     * 构建参数
     */
    private List<BuildParameter> actions;
    
    /**
     * 构建变更集
     */
    private List<ChangeSet> changeSets;
    
    /**
     * 构建制品
     */
    private List<Artifact> artifacts;
    
    /**
     * 构建控制台输出
     */
    private String consoleLog;
    
    @Data
    public static class BuildParameter {
        @JsonProperty("_class")
        private String type;
        private List<Parameter> parameters;
        private Map<String, Object> causes;
    }
    
    @Data
    public static class Parameter {
        @JsonProperty("_class")
        private String type;
        private String name;
        private String value;
    }
    
    @Data
    public static class ChangeSet {
        private String kind;
        private List<ChangeSetItem> items;
    }
    
    @Data
    public static class ChangeSetItem {
        private String commitId;
        private String author;
        private String message;
        private Long timestamp;
        private List<String> affectedPaths;
    }
    
    @Data
    public static class Artifact {
        private String displayPath;
        private String fileName;
        private String relativePath;
    }
} 