dbmsv4/app/Entities/Equipment/CHASSISEntity.php
2025-12-24 09:59:11 +09:00

67 lines
1.6 KiB
PHP

<?php
namespace App\Entities\Equipment;
use App\Models\Equipment\CHASSISModel;
class CHASSISEntity extends EquipmentEntity
{
const PK = CHASSISModel::PK;
const TITLE = CHASSISModel::TITLE;
protected $attributes = [
'title' => '',
'price' => 0,
'used' => 0,
'stock' => 0,
'status' => '',
'cpu_cnt' => 0,
'ram_cnt' => 0,
'disk_cnt' => 0,
];
public function __construct(array|null $data = null)
{
parent::__construct($data);
}
public function getCPUInfoUid(): int|null
{
return $this->attributes['cpuinfo_uid'] ?? null;
}
public function getRAMInfoUid(): int|null
{
return $this->attributes['raminfo_uid'] ?? null;
}
public function getDISKInfoUid(): int|null
{
return $this->attributes['diskinfo_uid'] ?? null;
}
//기본기능
public function getPrice(): int
{
return $this->attributes['price'] ?? 0;
}
public function getStock(): int
{
return $this->attributes['stock'] ?? 0;
}
public function getUsed(): int
{
return $this->attributes['used'] ?? 0;
}
public function getAvailable(): int
{
return $this->getStock() - $this->getUsed();
}
public function getCPUCnt(): int
{
return $this->attributes['cpu_cnt'] ?? 0;
}
public function getRAMCnt(): int
{
return $this->attributes['ram_cnt'] ?? 0;
}
public function getDISKCnt(): int
{
return $this->attributes['disk_cnt'] ?? 0;
}
}