<?php

namespace NoahVet\Reef\Domain\Security\Policy;

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

class PolicyResultGrant
{
    protected Resource|ResourceGroup $resource;

    protected string $principal;

    /**
     * @var list<string>
     */
    protected array $allow;

    /**
     * @var list<string>
     */
    protected array $deny;

    /**
     * @param list<string> $allow
     * @param list<string> $deny
     */
    public function __construct(
        Resource|ResourceGroup $resource,
        string $principal,
        array $allow,
        array $deny = [],
    ) {
        $this->resource = $resource;
        $this->principal = $principal;
        $this->allow = $allow;
        $this->deny = $deny;
    }

    public function getResource(): Resource|ResourceGroup
    {
        return $this->resource;
    }

    public function getPrincipal(): string
    {
        return $this->principal;
    }

    /**
     * @return list<string>
     */
    public function getAllow(): array
    {
        return $this->allow;
    }

    /**
     * @return list<string>
     */
    public function getDeny(): array
    {
        return $this->deny;
    }
}
