<?php
// @deprecated
declare(strict_types=1);
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Trait\TimestampableEntity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;
/**
* Represents a commission related to a transaction.
*
* @see https://schema.org/Thing
*/
#[ORM\Entity]
#[ApiResource(
iri: 'Commission',
itemOperations: [
'get' => ['normalization_context' => ['groups' => 'commission:item:get', 'enable_max_depth' => true]],
'put' => [
'normalization_context' => ['groups' => 'commission:item:put', 'enable_max_depth' => true],
'denormalization_context' => ['groups' => 'commission:item:put', 'enable_max_depth' => true],
],
'delete' => [],
],
collectionOperations: [
'get' => [
'normalization_context' => [
'groups' => ['commission:collection:get', 'createdAt'],
'enable_max_depth' => true,
],
],
'post' => [
'normalization_context' => ['groups' => 'commission:collection:post', 'enable_max_depth' => true],
'denormalization_context' => ['groups' => 'commission:collection:post', 'enable_max_depth' => true],
],
],
)]
class Commission
{
use TimestampableEntity;
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'NONE')]
#[ORM\Column(type: 'uuid', unique: true)]
#[ApiProperty(iri: 'https://schema.org/identifier')]
private ?UuidInterface $id = null;
/**
* The type of the commission.
*/
#[ORM\Column(type: 'string', nullable: false)]
#[ApiProperty(iri: 'https://schema.org/commissionType')]
#[Assert\NotBlank]
#[Assert\Type('string')]
#[Groups(['commission:collection:get', 'commission:collection:post', 'commission:item:get', 'commission:item:put'])]
private ?string $commissionType = null;
/**
* The percentage value of the commission.
*/
#[ORM\Column(type: 'float', nullable: false)]
#[ApiProperty(iri: 'https://schema.org/percentage')]
#[Assert\NotBlank]
#[Assert\Type('float')]
#[Groups(['commission:collection:get', 'commission:collection:post', 'commission:item:get', 'commission:item:put'])]
private ?float $percentage = null;
public function __construct()
{
$this->id = Uuid::uuid4();
}
public function getId(): ?UuidInterface
{
return $this->id;
}
public function setCommissionType(?string $commissionType): void
{
$this->commissionType = $commissionType;
}
public function getCommissionType(): ?string
{
return $this->commissionType;
}
public function setPercentage(?float $percentage): void
{
$this->percentage = $percentage;
}
public function getPercentage(): ?float
{
return $this->percentage;
}
}