const swaggerAutogen = require('swagger-autogen')();
const host = process.env.HOST || 'localhost:5000';
const doc = {
  info: {
    title: 'Cab Booking API',
    version: '2.0.0',
    description: 'RESTful API for Cab Booking Platform - Entity-based architecture with separated Controller-Service layers.',
  },
  tags: [
    { name: 'Auth', description: 'Authentication (register, login, OTP, password reset, profile)' },
    { name: 'User', description: 'User management and insights' },
    { name: 'Zone', description: 'Zone/area management' },
    { name: 'Vendor', description: 'Vendor management' },
    { name: 'Driver', description: 'Driver management and documents' },
    { name: 'Vehicle', description: 'Vehicle management (instances, categories, groups, brands, models)' },
    { name: 'Booking', description: 'Booking/ride management' },
    // { name: 'Dashboard', description: 'Analytics and statistics' },
    { name: 'Zone-Admin', description: 'Zone admin dashboard and operations' },
    { name: 'Ticket', description: 'Support ticketing system for drivers and vendors' },
    // { name: 'Zone-Admin-Driver', description: 'Zone admin driver operations' },
  ],
  basePath: '/api/v1',
  securityDefinitions: {
    bearerAuth: {
      type: 'apiKey',
      name: 'Authorization',
      scheme: 'bearer',
      in: 'header',
      description: 'Enter the token with the `Bearer ` prefix, e.g., "Bearer YOUR_TOKEN"',
    },
  },
  security: [{ bearerAuth: [] }],
  schemes: ['http', 'https'],
  // host: 'localhost:5000',
  host: host,
};

const outputFile = './swagger-output.json';
const routes = ['./routes/router.js'];

swaggerAutogen(outputFile, routes, doc);