<?php

it('documents module usage summary, detail, and quota update endpoints in openapi', function (): void {
    $content = file_get_contents(app_path('openapi.yaml'));

    expect($content)->toContain('/modules/usage/summary:')
        ->and($content)->toContain('operationId: getModuleUsageSummary')
        ->and($content)->toContain('/modules/usage/{moduleKey}:')
        ->and($content)->toContain('operationId: getModuleUsageDetail')
        ->and($content)->toContain('/modules/quotas/{moduleKey}/{metricKey}:')
        ->and($content)->toContain('operationId: updateModuleQuotaSetting')
        ->and($content)->toContain('ModuleUsageSummary:')
        ->and($content)->toContain('ModuleUsageDetail:')
        ->and($content)->toContain('ModuleUsageMetric:')
        ->and($content)->toContain('ModuleQuotaUpdateRequest:');
});

it('documents unavailable provider quota fields in openapi', function (): void {
    $content = file_get_contents(app_path('openapi.yaml'));

    expect($content)->toContain('usage_available:')
        ->and($content)->toContain('unavailable_reason:')
        ->and($content)->toContain('enum: [unreadable_payload, missing_limit, missing_usage, invalid_limit]')
        ->and($content)->toContain('detected_keys:');
});
