import axiosInstance from "@/shared/services/axiosInstance";
import { AxiosResponse } from "axios";
import { withHeaders } from "./withHeaders";

export interface OrgHeaders {
  tenantKey: string;
  unitId?: string;
}

export interface OrgType {
  id: string;
  name: {
    am: string;
    en: string;
  };
  key: string;
  createdAt: string;
  updatedAt: string;
}

export interface OrgTypeResponse {
  count: number;
  items: OrgType[];
}

export const getOrganizationTypes = async (): Promise<
  AxiosResponse<OrgTypeResponse>
> => {
  return axiosInstance.get("/organization-types", { headers: withHeaders() });
};
