<?php

namespace App\Entity;

use App\Repository\WebrootPermissionRepository;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity(repositoryClass: WebrootPermissionRepository::class)]
#[ORM\Table(name:'mydevel_webroot_file_permission')]
class WebrootFilePermission
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\OneToOne(cascade: ['persist', 'remove'])]
    #[ORM\JoinColumn(nullable: false)]
    private ?WebrootRole $role = null;

    #[ORM\Column(options:["default"=>true])]
    private ?bool $is_readable = null;

    #[ORM\Column(options:["default"=>false])]
    private ?bool $is_writeable = null;

    #[ORM\Column(options:["default"=>false])]
    private ?bool $is_deleteable = null;

    #[ORM\ManyToOne(inversedBy: 'permissions')]
    #[ORM\JoinColumn(nullable: false)]
    private ?WebrootFile $webrootFile = null;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getRole(): ?WebrootRole
    {
        return $this->role;
    }

    public function setRole(WebrootRole $role): static
    {
        $this->role = $role;

        return $this;
    }

    public function isReadable(): ?bool
    {
        return $this->is_readable;
    }

    public function setReadable(bool $is_readable): static
    {
        $this->is_readable = $is_readable;

        return $this;
    }

    public function isWriteable(): ?bool
    {
        return $this->is_writeable;
    }

    public function setWriteable(bool $is_writeable): static
    {
        $this->is_writeable = $is_writeable;

        return $this;
    }

    public function isDeleteable(): ?bool
    {
        return $this->is_deleteable;
    }

    public function setDeleteable(bool $is_deleteable): static
    {
        $this->is_deleteable = $is_deleteable;

        return $this;
    }
    
    public function getWebrootFile(): ?WebrootFile
    {
        return $this->webrootFile;
    }

    public function setWebrootFile(?WebrootFile $webrootFile): static
    {
        $this->webrootFile = $webrootFile;

        return $this;
    }
}
