/**
 * 服务管理模块类型定义
 *
 * 包含服务授权与目标配置的类型。
 */

// ============================================================
// 目标配置
// ============================================================

/** 目标服务器配置 */
export interface ManageTarget {
  id: string
  name: string
  host: string
  port: number
  protocol: 'http' | 'https'
  auth_type: 'password' | 'token' | 'none'
  username: string
  has_password: boolean
  connected: boolean
  created_at: string
  updated_at: string
}

/** 新建目标请求 */
export interface CreateManageTargetRequest {
  name: string
  host: string
  port?: number
  protocol?: 'http' | 'https'
  auth_type?: 'password' | 'token' | 'none'
  username?: string
  password?: string
}

/** 更新目标请求 */
export interface UpdateManageTargetRequest {
  name?: string
  host?: string
  port?: number
  protocol?: 'http' | 'https'
  auth_type?: 'password' | 'token' | 'none'
  username?: string
  password?: string
}

/** 测试连接请求 */
export interface TestManageTargetRequest {
  host: string
  port?: number
  protocol?: 'http' | 'https'
  username?: string
  password?: string
}

/** 测试连接响应 */
export interface TestManageTargetResponse {
  success: boolean
  message: string
}

// ============================================================
// 服务授权
// ============================================================

/** 授权任务状态 */
export interface LicenseTaskStatus {
  taskId: string
  status: 'pending' | 'processing' | 'completed' | 'failed'
  message: string
}

/** 上传授权文件响应 */
export interface UploadLicenseResponse {
  success: boolean
  taskId: string
  status: string
  message: string
}

/** 项目信息 */
export interface ProjectInfo {
  salesPeople: string
  deployer: string
  orderTime: string
  serverPassword?: string
  has_password?: boolean
  projectOverview: string
  updated_at?: string
}

/** 保存项目信息请求 */
export interface SaveProjectRequest {
  salesPeople: string
  deployer: string
  orderTime: string
  serverPassword: string
  projectOverview: string
}

/** 文件上传结果 */
export interface UploadFileResult {
  success: boolean
  message: string
  file?: {
    filename: string
    path: string
    size: number
  }
}