import client from '@/api/client';

export const eorService = {
  getChecklist: async (applicationId?: string, relocationId?: string) => {
    const path = relocationId ? `/eor/relocation/${relocationId}` : `/eor/application/${applicationId}`;
    const response = await client.get(path);
    return response.data as any;
  },

  createChecklist: async (data: { applicationId?: string; relocationId?: string }) => {
    const response = await client.post('/eor', data);
    return response.data as any;
  },

  updateItem: async (checklistId: string, data: {
    itemType: string;
    description: string;
    isCompliant: boolean;
    remarks?: string;
    proofDocumentId?: string;
  }) => {
    const response = await client.post(`/eor/item/${checklistId}`, data);
    return response.data as any;
  },

  submitAudit: async (checklistId: string, data: {
    status: string;
    overallComments?: string;
  }) => {
    const response = await client.post(`/eor/audit/${checklistId}`, data);
    return response.data as any;
  }
};
