<?php

namespace Opentalent\OtAdmin\Domain\Entity;

/**
 * Basic information about a typo3 website
 */
class SiteInfos
{
    protected int $rootUid;
    protected string $siteTitle = "";
    protected string $baseUrl = "";
    protected string $template = "";
    protected string $preferences = "";
    protected ?int $matomoId = null;
    protected ?bool $isPremium = null;
    protected bool $deleted = false;
    protected bool $hiddenOrRestricted = false;
    protected array $mountedForBeUsers = [];
    protected array $mountedForBeGroups = [];
    protected ?int $ownerUserUid = null;
    protected ?int $ownerGroupUid = null;

    /**
     * SiteInfos constructor.
     * @param int $rootUid
     * @param string|null $siteTitle
     * @param string|null $baseUrl
     * @param string|null $template
     * @param string|null $preferences
     * @param int|null $matomoId
     * @param bool|null $isPremium
     * @param bool $deleted
     * @param bool $hiddenOrRestricted
     * @param array|null $mountedForBeUsers
     * @param array|null $mountedForBeGroups
     * @param int|null $ownerUserUid
     * @param int|null $ownerGroupUid
     */
    public function __construct(
        int $rootUid,
        string $siteTitle = null,
        string $baseUrl = null,
        string $template = null,
        string $preferences = null,
        int $matomoId = null,
        bool $isPremium = null,
        bool $deleted = false,
        bool $hiddenOrRestricted = false,
        array $mountedForBeUsers = null,
        array $mountedForBeGroups = null,
        int $ownerUserUid = null,
        int $ownerGroupUid = null
    )
    {
        $this->rootUid = $rootUid;
        if ($siteTitle !== null) {
            $this->siteTitle = $siteTitle;
        }
        if ($baseUrl !== null) {
            $this->baseUrl = $baseUrl;
        }
        if ($template !== null) {
            $this->template = $template;
        }
        if ($preferences !== null) {
            $this->preferences = $preferences;
        }
        if ($matomoId !== null) {
            $this->matomoId = $matomoId;
        }
        if ($isPremium !== null) {
            $this->isPremium = $isPremium;
        }
        if ($deleted !== null) {
            $this->deleted = $deleted;
        }
        if ($hiddenOrRestricted !== null) {
            $this->hiddenOrRestricted = $hiddenOrRestricted;
        }
        if ($mountedForBeUsers !== null) {
            $this->mountedForBeUsers = $mountedForBeUsers;
        }
        if ($mountedForBeGroups !== null) {
            $this->mountedForBeGroups = $mountedForBeGroups;
        }
        if ($ownerUserUid !== null) {
            $this->ownerUserUid = $ownerUserUid;
        }
        if ($ownerGroupUid !== null) {
            $this->ownerGroupUid = $ownerGroupUid;
        }
    }

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

    /**
     * @param int $rootUid
     */
    public function setRootUid(int $rootUid): void
    {
        $this->rootUid = $rootUid;
    }

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

    /**
     * @param string $siteTitle
     */
    public function setSiteTitle(string $siteTitle): void
    {
        $this->siteTitle = $siteTitle;
    }

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

    /**
     * @param string $baseUrl
     */
    public function setBaseUrl(string $baseUrl): void
    {
        $this->baseUrl = $baseUrl;
    }

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

    /**
     * @param string $template
     */
    public function setTemplate(string $template): void
    {
        $this->template = $template;
    }

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

    /**
     * @param string $preferences
     */
    public function setPreferences(string $preferences): void
    {
        $this->preferences = $preferences;
    }

    /**
     * @return int
     */
    public function getMatomoId(): ?int
    {
        return $this->matomoId;
    }

    /**
     * @param int|null $matomoId
     */
    public function setMatomoId(?int $matomoId): void
    {
        $this->matomoId = $matomoId;
    }

    /**
     * @return bool | null
     */
    public function isPremium(): ?bool
    {
        return $this->isPremium;
    }

    /**
     * @param bool $isPremium
     */
    public function setIsPremium(bool $isPremium): void
    {
        $this->isPremium = $isPremium;
    }

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

    /**
     * @param bool $deleted
     */
    public function setDeleted(bool $deleted): void
    {
        $this->deleted = $deleted;
    }

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

    /**
     * @param bool $hiddenOrRestricted
     */
    public function setHiddenOrRestricted(bool $hiddenOrRestricted): void
    {
        $this->hiddenOrRestricted = $hiddenOrRestricted;
    }

    /**
     * @return array
     */
    public function getMountedForBeUsers(): array
    {
        return $this->mountedForBeUsers;
    }

    /**
     * @param array $mountedForBeUsers
     */
    public function setMountedForBeUsers(array $mountedForBeUsers): void
    {
        $this->mountedForBeUsers = $mountedForBeUsers;
    }

    /**
     * @param array $beUser ['uid' => int, 'username' => string]
     */
    public function addMountedForBeUser(array $beUser): void
    {
        $this->mountedForBeUsers[] = $beUser;
    }

    /**
     * @return array
     */
    public function getMountedForBeGroups(): array
    {
        return $this->mountedForBeGroups;
    }

    /**
     * @param array $mountedForBeGroups
     */
    public function setMountedForBeGroups(array $mountedForBeGroups): void
    {
        $this->mountedForBeGroups = $mountedForBeGroups;
    }

    /**
     * @param array $beGroup
     */
    public function addMountedForBeGroups(array $beGroup): void
    {
        $this->mountedForBeGroups[] = $beGroup;
    }

    /**
     * @return int|null
     */
    public function getOwnerUserUid(): ?int
    {
        return $this->ownerUserUid;
    }

    /**
     * @param int|null $ownerUserUid
     */
    public function setOwnerUserUid(?int $ownerUserUid): void
    {
        $this->ownerUserUid = $ownerUserUid;
    }

    /**
     * @return int|null
     */
    public function getOwnerGroupUid(): ?int
    {
        return $this->ownerGroupUid;
    }

    /**
     * @param int|null $ownerGroupUid
     */
    public function setOwnerGroupUid(?int $ownerGroupUid): void
    {
        $this->ownerGroupUid = $ownerGroupUid;
    }
}
