export interface ServiceInfo {
  serviceId: number;
  serviceCode: string;
  serviceName: string;
  serviceUrl: string | null;
  description: string | null;
  healthCheckUrl: string | null;
  healthCheckInterval: number;
  healthStatus: 'UP' | 'DOWN' | 'UNKNOWN';
  healthCheckedAt: string | null;
  healthResponseTime: number | null;
  isActive: boolean;
  createdAt: string;
}

export interface ServiceApi {
  apiId: number;
  serviceId: number;
  apiPath: string;
  apiMethod: string;
  apiName: string;
  apiDomain: string | null;
  apiSection: string | null;
  description: string | null;
  isActive: boolean;
  createdAt: string;
}

export interface CreateServiceRequest {
  serviceCode: string;
  serviceName: string;
  serviceUrl?: string;
  description?: string;
  healthCheckUrl?: string;
  healthCheckInterval?: number;
}

export interface UpdateServiceRequest {
  serviceName?: string;
  serviceUrl?: string;
  description?: string;
  healthCheckUrl?: string;
  healthCheckInterval?: number;
  isActive?: boolean;
}

export interface CreateServiceApiRequest {
  apiPath: string;
  apiMethod: string;
  apiName: string;
  apiDomain?: string;
  apiSection?: string;
  description?: string;
}

export interface HeartbeatStatus {
  serviceId: number;
  serviceCode: string;
  serviceName: string;
  healthStatus: string;
  healthCheckedAt: string | null;
  healthResponseTime: number | null;
}

export interface DailyUptime {
  date: string;
  totalChecks: number;
  upChecks: number;
  uptimePercent: number;
}

export interface RecentCheck {
  status: string;
  responseTime: number | null;
  errorMessage: string | null;
  checkedAt: string;
}

export interface ServiceStatusDetail {
  serviceId: number;
  serviceCode: string;
  serviceName: string;
  currentStatus: string;
  lastResponseTime: number | null;
  lastCheckedAt: string | null;
  uptimePercent90d: number;
  dailyUptime: DailyUptime[];
  recentChecks: RecentCheck[];
}

export interface HealthHistory {
  logId: number;
  serviceId: number;
  previousStatus: string | null;
  currentStatus: string;
  responseTime: number | null;
  errorMessage: string | null;
  checkedAt: string;
}

export interface UpdateServiceApiRequest {
  apiPath?: string;
  apiMethod?: string;
  apiName?: string;
  apiDomain?: string;
  apiSection?: string;
  description?: string;
  isActive?: boolean;
}

export interface ApiSpecInfo {
  specId: number;
  apiId: number;
  sampleUrl: string | null;
  authRequired: boolean;
  authType: string | null;
  deprecated: boolean;
  dataFormat: string | null;
  referenceUrl: string | null;
  note: string | null;
  createdAt: string;
  updatedAt: string;
}

export interface ApiParamInfo {
  paramId: number;
  apiId: number;
  paramType: 'REQUEST' | 'RESPONSE';
  paramName: string;
  paramMeaning: string | null;
  paramDescription: string | null;
  required: boolean;
  defaultValue: string | null;
  inputType: string | null;
  sortOrder: number;
}

export interface ApiDetailInfo {
  api: ServiceApi;
  spec: ApiSpecInfo | null;
  requestParams: ApiParamInfo[];
  responseParams: ApiParamInfo[];
}

export interface SaveApiSpecRequest {
  sampleUrl?: string;
  authRequired?: boolean;
  authType?: string;
  deprecated?: boolean;
  dataFormat?: string;
  referenceUrl?: string;
  note?: string;
}

export interface SystemConfigInfo {
  configId: number;
  configKey: string;
  configValue: string | null;
  description: string | null;
  createdAt: string;
  updatedAt: string;
}

export interface SaveApiParamRequest {
  paramType: 'REQUEST' | 'RESPONSE';
  paramName: string;
  paramMeaning?: string;
  paramDescription?: string;
  required?: boolean;
  defaultValue?: string;
  inputType?: string;
  sortOrder?: number;
}
