import type { BaseResponse } from '@/types/api';

export interface JenkinsDTO {
  id: number;
  name: string;
  url: string;
  username: string;
  password?: string;
  sort: number;
  remark?: string;
  lastAllSyncTime?: string;
  lastViewSyncTime?: string;
  lastJobSyncTime?: string;
  lastBuildSyncTime?: string;
  createTime?: string;
  updateTime?: string;
  version?: number;
  createBy?: string;
  updateBy?: string;
  deleted: boolean;
}

export interface JenkinsQuery {
  name?: string;
  url?: string;
}

export interface TestConnectionDTO {
  url: string;
  username: string;
  password: string;
}

export interface JenkinsSyncHistoryDTO {
  id: number;
  jenkinsId: number;
  jenkinsName: string;
  syncType: 'ALL' | 'VIEW' | 'JOB' | 'BUILD';
  status: 'SUCCESS' | 'FAILED' | 'RUNNING';
  startTime: string;
  endTime?: string;
  errorMessage?: string;
}

export interface JenkinsViewDTO {
  id: number;
  jenkinsId: number;
  viewName: string;
  viewUrl: string;
  description?: string;
  createTime?: string;
  updateTime?: string;
}

export interface JenkinsJobDTO {
  id: number;
  jenkinsId: number;
  jobName: string;
  jobUrl: string;
  description?: string;
  buildable: boolean;
  lastBuildNumber?: number;
  lastBuildTime?: string;
  lastBuildStatus?: string;
  createTime?: string;
  updateTime?: string;
}

export interface JenkinsBuildDTO {
  id: number;
  jenkinsId: number;
  jobId: number;
  buildNumber: number;
  buildUrl: string;
  buildStatus: string;
  startTime: string;
  duration: number;
  triggerCause?: string;
  createTime?: string;
  updateTime?: string;
}

export type ApiResponse<T> = Promise<BaseResponse<T>>; 