'use client';

import type {
  ExchangeCodeResponse,
  RefreshTokenResponse,
} from '@pac/types';
import { api } from './api-client';

export async function exchangeCode(code: string): Promise<ExchangeCodeResponse> {
  return api.post<ExchangeCodeResponse>(
    '/pac/v1/auth/exchange-code',
    { code },
    { auth: false },
  );
}

export async function refreshToken(token: string): Promise<RefreshTokenResponse> {
  return api.post<RefreshTokenResponse>(
    '/pac/v1/auth/refresh',
    { refreshToken: token },
    { auth: false },
  );
}
