import axios from "../../../config/axios";
import { CreateGuideType } from "../types/Types";

export const getGuides = async (id: string) => {
  const { data } = await axios.get(`/danak-services/${id}/guides`);
  return data;
};

export const createGuide = async (params: CreateGuideType) => {
  const { data } = await axios.post(`/danak-services/guides`, params);
  return data;
};

export const deleteGuide = async (id: string) => {
  const { data } = await axios.delete(`/danak-services/guides/${id}`);
  return data;
};

export const getGuideDetail = async (id: string) => {
  const { data } = await axios.get(`/danak-services/guides/${id}`);
  return data;
};

export type UpdateGuideType = {
  title: string;
  description: string;
  content: string;
  order: number;
  isActive: boolean;
};

export const updateGuide = async (id: string, params: UpdateGuideType) => {
  const { data } = await axios.patch(`/danak-services/guides/${id}`, params);
  return data;
};
