<?php

namespace NoahVet\Reef\Security\Policy;

use NoahVet\Reef\Domain\Security\Model\Resource;
use NoahVet\Reef\Domain\Security\Model\ResourceGroup;

/**
 * @deprecated Use \NoahVet\Reef\Domain\Security\Policy\PolicyResultGrant instead
 */
class PolicyResultGrant extends \NoahVet\Reef\Domain\Security\Policy\PolicyResultGrant
{
    /**
     * @param array{"allow": string[], "deny": string[]} $permissionGrants
     */
    public function __construct(
        Resource|ResourceGroup $resource,
        string $principal,
        array $permissionGrants,
    ) {
        parent::__construct(
            $resource,
            $principal,
            \array_values($permissionGrants['allow']),
            \array_values($permissionGrants['deny']),
        );
    }

    /**
     * @return array{"allow": list<string>, "deny": list<string>}
     */
    public function getPermissionGrants(): array
    {
        return ['allow' => $this->allow, 'deny' => $this->deny];
    }
}
