import { api } from "../utils/axiosClient";

export const DirectoryRepository = {
  GetOrganizations: () => api.get("/api/directory/organization"),
  GetDesignations: () => api.get("/api/directory/designations"),
  GetContacts: (isActive, projectId) => {
    const params = new URLSearchParams();
    params.append("active", isActive);

    if (projectId) {
      params.append("projectId", projectId);
    }

    return api.get(`/api/Directory?${params.toString()}`);
  },
  CreateContact: (data) => api.post("/api/directory", data),
  UpdateContact: (id, data) => api.put(`/api/directory/${id}`, data),
  DeleteContact: (id, isActive) =>
    api.delete(`/api/directory/${id}/?active=${isActive}`),
  AssignedBuckets: (id, data) =>
    api.post(`/api/directory/assign-bucket/${id}`, data),

  GetBucktes: () => api.get(`/api/directory/buckets`),
  CreateBuckets: (data) => api.post(`/api/Directory/bucket`, data),
  UpdateBuckets: (id, data) => api.put(`/api/Directory/bucket/${id}`, data),
  DeleteBucket: (id) => api.delete(`/api/directory/bucket/${id}`),

  GetContactProfile: (id) => api.get(`/api/directory/profile/${id}`),

  CreateNote: (data) => api.post("/api/directory/note", data),
  GetNote: (id, isActive) =>
    api.get(`/api/directory/notes/${id}?active=${isActive}`),
  UpdateNote: (id, data) => api.put(`/api/directory/note/${id}`, data),
  DeleteNote: (id, isActive) =>
    api.delete(`/api/directory/note/${id}?active=${isActive}`),

  GetNotes: (pageSize, pageNumber) =>
    api.get(`/api/directory/notes?pageSize=${pageSize}&pageNumber=${pageNumber}`),
};
