id = (int)$data['id']; $obj->name = $data['name']; $obj->type = $data['type']; $obj->description = $data['description'] ?? null; $obj->primaryIp = $data['primary_ip'] ?? null; $obj->macAddress = $data['mac_address'] ?? null; $obj->hostname = $data['hostname'] ?? null; $obj->vendor = $data['vendor'] ?? null; $obj->osName = $data['os_name'] ?? null; $obj->osVersion = $data['os_version'] ?? null; $obj->location = $data['location'] ?? null; $obj->importance = $data['importance']; $obj->status = $data['status']; $obj->createdAt = new \DateTimeImmutable($data['created_at']); $obj->updatedAt = new \DateTimeImmutable($data['updated_at']); return $obj; } public static array $types = [ 'server', 'router', 'nas', 'desktop', 'laptop', 'phone', 'printer', 'iot', 'vm', 'container_host', 'unknown', ]; public static array $importances = ['critical', 'high', 'normal', 'low']; }