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

type SetupRequirements = {
  hasSeal: boolean;
  hasHeader: boolean;
  hasFooter: boolean;
  internalPrefix: boolean;
  externalPrefix: boolean;
  internalSuffix: boolean;
  externalSuffix: boolean;
};

export interface AdminSetupAlertResponse {
  unitId: string;
  requirements: SetupRequirements;
  allSatisfied: boolean;
}

export const fetchRequirementSatisfied = async (
  id: string | number
): Promise<AdminSetupAlertResponse> => {
  const res = await axiosInstance.get(`/units/${id}/requirement-satisfied`, {
    headers: withHeaders(),
  });
  return res.data; // <--- THIS IS KEY
};
