import axios from "@/config/axios";
import {
  BlogCategoryResponse,
  BlogCombinedResponse,
  BlogResponse,
  BlogSingleResponse,
} from "../types/BlogTypes";

export const getBlogs = async () => {
  const { data } = await axios.get<BlogResponse>(`/blogs`);
  return data;
};

export const getMostVisitedBlogs = async () => {
  const { data } = await axios.get<BlogResponse>(`/blogs/most-visited`);
  return data;
};

export const getBlogCategories = async () => {
  const { data } = await axios.get<BlogCategoryResponse>(
    `/blogs/categories/public`
  );
  return data;
};

export const getBlogsPinned = async () => {
  const { data } = await axios.get<BlogResponse>(`/blogs/pinned`);
  return data;
};

export const getCombinedBlogs = async () => {
  const { data } = await axios.get<BlogCombinedResponse>(`/blogs/combined`);
  return data;
};

export const getBlogSingle = async (id: string) => {
  const { data } = await axios.get<BlogSingleResponse>(`/blogs/${id}`);
  return data;
};
