ogcore/src/Dto/Output/OperativeSystemOutput.php

42 lines
1.2 KiB
PHP

<?php
namespace App\Dto\Output;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\Get;
use App\Entity\OperativeSystem;
use Symfony\Component\Serializer\Annotation\Groups;
#[Get(shortName: 'OperativeSystem')]
final class OperativeSystemOutput extends AbstractOutput
{
#[Groups(['operative-system:read', 'partition:read', 'software-profile:read', 'client:read'])]
#[ApiProperty(
description: 'El nombre del sistema operativo',
example: 'Windows 10 Pro'
)]
public string $name;
#[Groups(['operative-system:read'])]
#[ApiProperty(
description: 'Fecha de creación del sistema operativo',
example: '2024-01-15T10:30:00+00:00'
)]
public \DateTime $createdAt;
#[Groups(['operative-system:read'])]
#[ApiProperty(
description: 'Usuario que creó este registro',
example: 'admin'
)]
public ?string $createdBy = null;
public function __construct(OperativeSystem $operativeSystem)
{
parent::__construct($operativeSystem);
$this->name = $operativeSystem->getName();
$this->createdAt = $operativeSystem->getCreatedAt();
$this->createdBy = $operativeSystem->getCreatedBy();
}
}