import { apiRequest } from './apiClient';

import type {
  AvailableIpResponse,
  PeerRegistrationRequest,
  PeerRegistrationResponse,
  UsedIpsResponse,
} from '@/types/api';

export const vpnApi = {
  availableIp: () =>
    apiRequest<AvailableIpResponse>(
      '/api/vpn/available-ip',
    ),

  usedIps: () =>
    apiRequest<UsedIpsResponse>(
      '/api/vpn/used-ips',
    ),

  registerPeer: (
    body: PeerRegistrationRequest,
  ) =>
    apiRequest<PeerRegistrationResponse>(
      '/api/vpn/peers',
      {
        method: 'POST',
        body: JSON.stringify(body),
      },
    ),
};