<?php

namespace App\Entities\Equipment;

use App\Models\Equipment\ServerModel;

class ServerEntity extends EquipmentEntity
{
    const PK    = ServerModel::PK;
    const TITLE = ServerModel::TITLE;
    public function getTitle(): string
    {
        return parent::getTitle() . " [{$this->attributes['model']}]";
    }
    public function getPartEntities(string $type): array
    {
        return $this->attributes[$type] ?? [];
    }

    public function setPartEntities(string $type, array $partEntities): void
    {
        if (!isset($this->attributes[$type])) {
            $this->attributes[$type] = [];
        }
        $this->attributes[$type] = $partEntities;
        // $this->attributes[$type] = array_unique($this->attributes[$type], SORT_REGULAR);
    }
}
