<?php

namespace NoahVet\Reef\Jane\Model;

class PermissionGrantList extends \ArrayObject
{
    /**
     * @var array
     */
    protected $initialized = [];

    /**
     * @var array<string, PermissionGrant>
     */
    protected $groups;

    /**
     * @var array<string, PermissionGrant>
     */
    protected $resources;

    public function isInitialized($property): bool
    {
        return \array_key_exists($property, $this->initialized);
    }

    /**
     * @return array<string, PermissionGrant>
     */
    public function getGroups(): iterable
    {
        return $this->groups;
    }

    /**
     * @param array<string, PermissionGrant> $groups
     */
    public function setGroups(iterable $groups): self
    {
        $this->initialized['groups'] = true;
        $this->groups = $groups;

        return $this;
    }

    /**
     * @return array<string, PermissionGrant>
     */
    public function getResources(): iterable
    {
        return $this->resources;
    }

    /**
     * @param array<string, PermissionGrant> $resources
     */
    public function setResources(iterable $resources): self
    {
        $this->initialized['resources'] = true;
        $this->resources = $resources;

        return $this;
    }
}
