import { generateApi } from 'swagger-typescript-api';
import path from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

(async () => {
    try {
        await generateApi({
            input: path.resolve(__dirname, './auth_swagger.json'),
            output: path.resolve(__dirname, '../src/client'),
            name: 'auth_client.ts',
        });
        console.log('API client generated successfully');
    } catch (error) {
        console.error('Error generating API client:', error);
    }
})();
