<?php
namespace App\Entity\Webmail;
use App\Entity\User;
use App\Repository\Webmail\AccountAccessRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: AccountAccessRepository::class)]
#[ORM\Table(name: 'webmail_account_access')]
class AccountAccess
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'accountAccesses')]
#[ORM\JoinColumn(nullable: false)]
private ?Account $account = null;
#[ORM\ManyToOne(inversedBy: 'webmailAccountAccesses')]
#[ORM\JoinColumn(nullable: false)]
private ?User $user = null;
#[ORM\Column(length: 255, enumType: Role::class, options: ['default' => Role::ReadOnly])]
private ?Role $role = Role::ReadWrite;
#[ORM\Column(options: ['default' => false])]
private ?bool $preferred = true;
public function getId(): ?int
{
return $this->id;
}
public function getAccount(): ?Account
{
return $this->account;
}
public function setAccount(?Account $account): self
{
$this->account = $account;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getRole(): ?Role
{
return $this->role;
}
public function setRole(Role $role): self
{
$this->role = $role;
return $this;
}
public function isPreferred(): ?bool
{
return $this->preferred;
}
public function setPreferred(bool $preferred): self
{
$this->preferred = $preferred;
return $this;
}
}