import axios from 'axios';
import { API_BASE_URL } from '../config';

export interface ContactFormData {
  name: string;
  email: string;
  subject: string;
  message: string;
}

export const submitContactForm = async (data: ContactFormData) => {
  const response = await axios.post(`${API_BASE_URL}/api/v1/contact`, data);
  return response.data;
};

export const subscribeToNewsletter = async (email: string) => {
  const response = await axios.post(`${API_BASE_URL}/api/v1/newsletter/subscribe`, { email });
  return response.data;
};

export const unsubscribeFromNewsletter = async (email: string) => {
  const response = await axios.post(`${API_BASE_URL}/api/v1/newsletter/unsubscribe/${encodeURIComponent(email)}`);
  return response.data;
};
