<?php
namespace App\Model\SecurityGroup;
use App\Model\Customer\Customer;
use App\Model\Traits\ImportableObjectTrait;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Class SecurityGroup.
*/
class SecurityGroup
{
use ImportableObjectTrait;
/**
* @var string|null
* @Groups({"list", "read", "write_put"})
*/
private $id;
/**
* @Assert\NotNull
*
* @var string|null
* @Groups({"list", "read", "write_put"})
*/
private $name;
/**
* @var Customer|null
* @Groups({"list", "read"})
*/
private $customer;
/**
* @var array
* @Groups({"list", "read", "write_put"})
*/
private $roles = [];
/**
* @var string|null
* @Groups({"list", "read", "write_put"})
*/
private $usersFormatted;
/**
* @return string|null
*/
public function getId(): ?string
{
return $this->id;
}
/**
* @param string|null $id
*
* @return SecurityGroup
*/
public function setId(?string $id): SecurityGroup
{
$this->id = $id;
return $this;
}
/**
* @return string|null
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param string|null $name
*
* @return SecurityGroup
*/
public function setName(?string $name): SecurityGroup
{
$this->name = $name;
return $this;
}
/**
* @return array
*/
public function getRoles(): array
{
return $this->roles;
}
/**
* @param array $roles
*
* @return SecurityGroup
*/
public function setRoles(array $roles): SecurityGroup
{
$this->roles = $roles;
return $this;
}
/**
* @return Customer|null
*/
public function getCustomer(): ?Customer
{
return $this->customer;
}
/**
* @param Customer|null $customer
*
* @return SecurityGroup
*/
public function setCustomer(?Customer $customer): SecurityGroup
{
$this->customer = $customer;
return $this;
}
/**
* @return string|null
*/
public function getCustomerName(): ?string
{
return $this->getCustomer() instanceof Customer ? $this->getCustomer()->getName() : '';
}
/**
* @return string
*/
public function getNameForSelect(): string
{
return $this->getName().' - '.$this->getCustomerName();
}
/**
* @return string|null
*/
public function getUsersFormatted(): ?string
{
return $this->usersFormatted;
}
/**
* @param string|null $usersFormatted
*
* @return SecurityGroup
*/
public function setUsersFormatted(?string $usersFormatted): SecurityGroup
{
$this->usersFormatted = $usersFormatted;
return $this;
}
}