import { api } from "@/lib/api-client";
import type { Training, TrainingTip, Walkthrough } from "@/types";

export const trainingService = {
  async getTraining(params?: { entity_id?: number; user_id?: number; module?: string }): Promise<Training[]> {
    return api.get<Training[]>("/training", params as Record<string, string | number | boolean | undefined>);
  },

  async getTips(params?: { subject_id?: number; category?: string }): Promise<TrainingTip[]> {
    return api.get<TrainingTip[]>("/training/tips", params as Record<string, string | number | boolean | undefined>);
  },

  async getWalkthroughs(module?: string): Promise<Walkthrough[]> {
    return api.get<Walkthrough[]>("/training/walkthrough", module ? { module } : undefined);
  },
};
