<?php

declare(strict_types=1);

namespace Tests\Feature\Baselines\Support;

use PHPUnit\Framework\Assert;

final class AssertsStructuredBaselineGaps
{
    /**
     * @param  array<string, mixed>  $subject
     */
    public static function assertStructuredSubject(array $subject): void
    {
        foreach ([
            'policy_type',
            'subject_key',
            'subject_class',
            'resolution_path',
            'resolution_outcome',
            'reason_code',
            'operator_action_category',
            'structural',
            'retryable',
        ] as $key) {
            Assert::assertArrayHasKey($key, $subject);
        }
    }

    /**
     * @param  list<array<string, mixed>>  $subjects
     */
    public static function assertStructuredSubjects(array $subjects): void
    {
        Assert::assertNotEmpty($subjects);

        foreach ($subjects as $subject) {
            Assert::assertIsArray($subject);
            self::assertStructuredSubject($subject);
        }
    }
}
