import type { BaseResponse } from '@/types/base';
import type { ExternalSystemResponse } from '@/pages/Deploy/External/types';

// 使用外部系统响应作为 Jenkins 实例
export type JenkinsInstance = ExternalSystemResponse;

// Jenkins 实例详情
export interface JenkinsInstanceDTO extends BaseResponse {
    totalViews: number;
    totalJobs: number;
    totalBuilds: number;
    lastSyncViewsTime?: string;
    lastSyncJobsTime?: string;
    lastSyncBuildsTime?: string;
    jenkinsViewList: JenkinsViewDTO[];
    jenkinsJobList: JenkinsJobDTO[];
}

// Jenkins 视图
export interface JenkinsViewDTO extends BaseResponse {
    description: string;
    externalSystemId: number;
    viewName: string;
    viewUrl: string;
}

// Jenkins 任务
export interface JenkinsJobDTO extends BaseResponse {
    buildable: boolean;
    description: string;
    jobName: string;
    jobUrl: string;
    nextBuildNumber: number;
    lastBuildNumber: number;
    lastBuildStatus: string;
    healthReportScore: number;
    lastBuildTime: string;
    externalSystemId: number;
    viewId: number;
}

// 同步类型
export type SyncType = 'views' | 'jobs' | 'builds';
