import { PaginationRequest } from "@/types/globals";
import {
  httpDeleteInterceptor,
  httpGet,
  httpPost,
  httpPut,
} from "./http-config/axios-base-service";

export async function createCustomStaticPage(data: any) {
  const headers = {
    "content-type": "application/json",
  };
  const pathUrl = `/custom-static-pages`;
  return await httpPost(pathUrl, headers, data);
}

export async function editCustomStaticPage(data: any) {
  const headers = {
    "content-type": "application/json",
  };
  const pathUrl = `/custom-static-pages/${data.id}`;
  return await httpPut(pathUrl, headers, data);
}

export async function getCustomStaticPage(props: PaginationRequest) {
  const { page, limit, search } = props;
  const headers = {
    "content-type": "application/json",
  };
  return await httpGet(
    `/custom-static-pages?limit=${limit}&page=${page}&title=${search}`,
    headers
  );
}
export async function getCustomStaticDetail(id: string) {
  const headers = {
    "content-type": "application/json",
  };
  return await httpGet(`/custom-static-pages/${id}`, headers);
}

export async function getCustomStaticDetailBySlug(slug: string) {
  const headers = {
    "content-type": "application/json",
  };
  return await httpGet(`/custom-static-pages/slug/${slug}`, headers);
}
