/**
 * 超级管理员操作密码 API
 */

import { BaseService } from '../BaseService'
import type { BaseResponse } from '@/types/api'

interface OperationPasswordStatusResponse {
  is_set: boolean
}

interface SetOperationPasswordParams {
  password: string
  confirm_password: string
}

export class SuperAdminService extends BaseService {
  /**
   * 查询操作密码是否已设置
   * GET /api/admin/super-admin/operation-password/status
   */
  static getOperationPasswordStatus(): Promise<BaseResponse<OperationPasswordStatusResponse>> {
    return this.get<BaseResponse<OperationPasswordStatusResponse>>(
      '/api/admin/super-admin/operation-password/status'
    )
  }

  /**
   * 设置/重置操作密码
   * POST /api/admin/super-admin/operation-password
   * @param params 包含 password 和 confirm_password
   */
  static setOperationPassword(params: SetOperationPasswordParams): Promise<BaseResponse> {
    return this.post<BaseResponse>('/api/admin/super-admin/operation-password', params)
  }
}
