/**
 * @description 学习计划相关API
 * @author yslg
 * @since 2025-10-15
 */

import { api } from '@/apis/index';
import type { LearningTask, ResultDomain } from '@/types';

/**
 * 学习计划API服务
 */
export const learningPlanApi = {
  /**
   * 获取学习计划列表
   * @returns Promise<ResultDomain<LearningTask>>
   */
  async getPlanList(): Promise<ResultDomain<LearningTask>> {
    const response = await api.get<LearningTask>('/study/learning-plan/list');
    return response.data;
  },

  /**
   * 根据ID获取计划详情
   * @param planID 计划ID
   * @returns Promise<ResultDomain<LearningTask>>
   */
  async getPlanById(planID: string): Promise<ResultDomain<LearningTask>> {
    const response = await api.get<LearningTask>(`/study/learning-plan/${planID}`);
    return response.data;
  }
};
