import { describe, expect, it } from 'vitest'

import { requireRole } from '../../middleware/requireRole'
import { requireSubscription } from '../../middleware/requireSubscription'
import { requireTenant } from '../../middleware/requireTenant'
import { requireCompanyAuth } from '../../middleware/requireCompanyAuth'

// Prisma-backed execution of the full stack belongs in the integration suite.
// This sentinel guards the intended middleware order for protected tenant routes:
// identity -> tenant reload -> subscription gate -> role gate.
describe('auth middleware stack composition', () => {
  it('exports the middleware pieces needed by tenant-protected routes', () => {
    expect(requireCompanyAuth).toEqual(expect.any(Function))
    expect(requireTenant).toEqual(expect.any(Function))
    expect(requireSubscription).toEqual(expect.any(Function))
    expect(requireRole('MANAGER' as never)).toEqual(expect.any(Function))
  })
})
