<?php


namespace iDServer\Saml;


class NameIdPolicy
{
    const FORMAT_PERSISTENT = 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent';
    const FORMAT_DEFAULT = self::FORMAT_PERSISTENT;
    
    /**
     * @var string
     */
    private $format;

    /**
     * @var string
     */
    private $spNameQualifier;

    /**
     * @var bool
     */
    private $allowCreate;

    /**
     * @param string $format
     * @param string $spNameQualifier
     * @param bool $allowCreate
     */
    public function __construct(
        string $spNameQualifier = null,
        string $format = null,
        bool $allowCreate = false
    ) {
        $this->spNameQualifier = $spNameQualifier;
        $this->format = $format;
        $this->allowCreate = $allowCreate;
    }

    /**
     * @return string
     */
    public function getFormat(): ?string
    {
        return $this->format;
    }

    /**
     * @return string
     */
    public function getSpNameQualifier(): ?string
    {
        return $this->spNameQualifier;
    }

    /**
     * @return bool
     */
    public function isAllowCreate(): bool
    {
        return $this->allowCreate;
    }
}
