import recordAxiosInstance from "./recordAxiosInstance";
import { AxiosResponse } from "axios";

export interface FileInfo {
  fileName: string;
  contentType: string;
  size: number;
  originalname: string;
}

export interface ComplaintPayload {
  fullName: string;
  phoneNumber: string;
  subCity: string;
  woreda: string;
  houseNumber: string;
  institution: string;
  complaintPlace: string;
  complaintDetail: string;
  desiredResolution: string;
  fileInfo?: FileInfo;
}

export interface ComplaintResponse {
  id: string;
  complaintNumber: string;
  status: string;
  createdAt: string;
  message?: string;
}

// Submit customer complaint
export const submitComplaint = async (
  payload: ComplaintPayload
): Promise<AxiosResponse<ComplaintResponse>> => {
  return recordAxiosInstance.post("/customer-complaints", payload);
};

// Get complaint by ID (for tracking)
export const getComplaintById = async (
  id: string
): Promise<AxiosResponse<ComplaintResponse>> => {
  return recordAxiosInstance.get(`/customer-complaints/${id}`);
};
