<?php

namespace App\Classes\Modules\Accounts\DataTransferObjects;


use App\Classes\common;

class UserInvitationObject
{

    /** @var integer */
    private $role;

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

    /** @var string|null */
    private $hash;

    /**
     * UserInvitationObject constructor.
     * @param int $role
     * @param string $inviteeEmail
     * @param null|string $hash
     * @throws \Exception
     */
    public function __construct(int $role, string $inviteeEmail, ?string $hash = null)
    {
        $this->role = $role;
        $this->inviteeEmail = $inviteeEmail;
        $this->hash = $hash ? $hash : Common::generateRandomHash(50);
    }

    /**
     * @return int
     */
    public function getRole(): int
    {
        return $this->role;
    }

    /**
     * @return string
     */
    public function getInviteeEmail(): string
    {
        return $this->inviteeEmail;
    }

    /**
     * @return string
     */
    public function getHash(): string
    {
        return $this->hash;
    }

    /**
     * @param null|string $hash
     */
    public function setHash(?string $hash): void
    {
        $this->hash = $hash;
    }


}