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

export const createCompany = async (data: CreateCompanyType) => {
  const response = await axios.post("/companies/requests", data);
  return response.data;
};

export const updateCompany = async ({
  id,
  data,
}: {
  id: string;
  data: CreateCompanyType;
}) => {
  const response = await axios.patch(`/companies/${id}/user`, data);
  return response.data;
};

export const getCompanyById = async (id: string) => {
  const response = await axios.get(`/companies/${id}`);
  return response.data;
};

export const uploadSingle = async (params: FormData) => {
  const { data } = await axios.post(`/uploader/single-file`, params);
  return data;
};

export const uploadMultiple = async (params: FormData) => {
  const { data } = await axios.post(`/uploader/multi-file`, params);
  return data;
};

export const createService = async (params: CreateCompanyType) => {
  const { data } = await axios.post("/companies/company-request", params);
  return data;
};
