/**
 * 陪练场景管理 API
 */
import request from '@/api/request'

/**
 * 陪练场景数据结构
 */
export interface PracticeScene {
  id: number
  name: string
  description?: string
  type: string
  difficulty: string
  status: string
  background: string
  ai_role: string
  objectives: string[]
  keywords?: string[]
  duration: number
  usage_count?: number
  rating?: number
  created_at?: string
  updated_at?: string
}

/**
 * 创建场景请求
 */
export interface CreateSceneRequest {
  name: string
  description?: string
  type: string
  difficulty: string
  status?: string
  background: string
  ai_role: string
  objectives: string[]
  keywords?: string[]
  duration: number
}

/**
 * 更新场景请求
 */
export interface UpdateSceneRequest {
  name?: string
  description?: string
  type?: string
  difficulty?: string
  status?: string
  background?: string
  ai_role?: string
  objectives?: string[]
  keywords?: string[]
  duration?: number
}

/**
 * 场景列表查询参数
 */
export interface SceneQueryParams {
  page?: number
  size?: number
  type?: string
  difficulty?: string
  search?: string
}

/**
 * 场景列表响应
 */
export interface SceneListResponse {
  items: PracticeScene[]
  total: number
  page: number
  size: number
  pages: number
}

/**
 * 获取陪练场景列表
 */
export function getPracticeScenes(params: SceneQueryParams) {
  return request.get<SceneListResponse>('/api/v1/practice/scenes', params)
}

/**
 * 获取场景详情
 */
export function getSceneDetail(sceneId: number) {
  return request.get<PracticeScene>(`/api/v1/practice/scenes/${sceneId}`)
}

/**
 * 创建陪练场景
 */
export function createPracticeScene(data: CreateSceneRequest) {
  return request.post<PracticeScene>('/api/v1/practice/scenes', data)
}

/**
 * 更新陪练场景
 */
export function updatePracticeScene(sceneId: number, data: UpdateSceneRequest) {
  return request.put<PracticeScene>(`/api/v1/practice/scenes/${sceneId}`, data)
}

/**
 * 删除陪练场景
 */
export function deletePracticeScene(sceneId: number) {
  return request.delete<{ scene_id: number }>(`/api/v1/practice/scenes/${sceneId}`)
}



