88 lines
2.7 KiB
PHP
88 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace App\Entities\Equipment;
|
|
|
|
use App\Entities\Equipment\ServerPartEntity;
|
|
use App\Models\Equipment\ServerModel;
|
|
|
|
class ServerEntity extends EquipmentEntity
|
|
{
|
|
const PK = ServerModel::PK;
|
|
const TITLE = ServerModel::TITLE;
|
|
const STATUS_AVAILABLE = "available";
|
|
const STATUS_OCCUPIED = "occupied";
|
|
const STATUS_FORBIDDEN = "forbidden";
|
|
const DEFAULT_STATUS = self::STATUS_AVAILABLE;
|
|
public function setSwitchEntity(SwitchEntity|null $entity): void
|
|
{
|
|
$this->attributes['switchEntity'] = $entity;
|
|
}
|
|
public function getSwitchEntity(): SwitchEntity|null
|
|
{
|
|
if (!array_key_exists('switchEntity', $this->attributes)) {
|
|
return null;
|
|
}
|
|
return $this->attributes['switchEntity'];
|
|
}
|
|
public function addServerPartEntity(string $partType, ServerPartEntity $entity): void
|
|
{
|
|
if (!array_key_exists('serverPartEntities', $this->attributes)) {
|
|
$this->attributes['serverPartEntities'] = [];
|
|
}
|
|
$this->attributes['serverPartEntities'][$partType] = $entity;
|
|
}
|
|
public function getServerPartEntity(string $partType): ServerPartEntity|null
|
|
{
|
|
if (!array_key_exists('serverPartEntities', $this->attributes)) {
|
|
return null;
|
|
}
|
|
if (!array_key_exists($partType, $this->attributes['serverPartEntities'])) {
|
|
return null;
|
|
}
|
|
return $this->attributes['serverPartEntities'][$partType];
|
|
}
|
|
public function addIPEntity(IPEntity $entity): void
|
|
{
|
|
if (!array_key_exists('ipEntities', $this->attributes)) {
|
|
$this->attributes['ipEntities'] = [];
|
|
}
|
|
$this->attributes['ipEntities'][] = $entity;
|
|
}
|
|
public function setIPEntities(array $ipEntities): void
|
|
{
|
|
$this->attributes['ipEntities'] = $ipEntities;
|
|
}
|
|
public function getIPEntities(): array
|
|
{
|
|
return $this->attributes['ipEntities'] ?? [];
|
|
}
|
|
public function addCSEntity(CSEntity $entity): void
|
|
{
|
|
if (!array_key_exists('csEntities', $this->attributes)) {
|
|
$this->attributes['csEntities'] = [];
|
|
}
|
|
$this->attributes['csEntities'] = $entity;
|
|
}
|
|
public function setCSEntities(array $csEntities): void
|
|
{
|
|
$this->attributes['csEntities'] = $csEntities;
|
|
}
|
|
public function getCSEntities(): array
|
|
{
|
|
return $this->attributes['csEntities'] ?? [];
|
|
}
|
|
//기본기능용
|
|
public function getCode(): string
|
|
{
|
|
return $this->attributes['code'];
|
|
}
|
|
public function getClientInfoUID(): int|null
|
|
{
|
|
return $this->attributes['clientinfo_uid'] ?? null;
|
|
}
|
|
public function getServiceInfoUID(): int|null
|
|
{
|
|
return $this->attributes['serviceinfo_uid'] ?? null;
|
|
}
|
|
}
|