<?php
namespace CrosierSource\CrosierLibRadxBundle\Entity\Estoque;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Core\Serializer\Filter\PropertyFilter;
use CrosierSource\CrosierLibBaseBundle\Doctrine\Annotations\EntityHandler;
use CrosierSource\CrosierLibBaseBundle\Doctrine\Annotations\NotUppercase;
use CrosierSource\CrosierLibBaseBundle\Doctrine\Annotations\TrackedEntity;
use CrosierSource\CrosierLibBaseBundle\Entity\EntityId;
use CrosierSource\CrosierLibBaseBundle\Entity\EntityIdTrait;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"movimentacaoItem","entityId"},"enable_max_depth"=true},
* denormalizationContext={"groups"={"movimentacaoItem"},"enable_max_depth"=true},
*
* itemOperations={
* "get"={"path"="/est/movimentacaoItem/{id}", "security"="is_granted('ROLE_ESTOQUE')"},
* "put"={"path"="/est/movimentacaoItem/{id}", "security"="is_granted('ROLE_ESTOQUE')"},
* "delete"={"path"="/est/movimentacaoItem/{id}", "security"="is_granted('ROLE_ADMIN')"}
* },
* collectionOperations={
* "get"={"path"="/est/movimentacaoItem", "security"="is_granted('ROLE_ESTOQUE')"},
* "post"={"path"="/est/movimentacaoItem", "security"="is_granted('ROLE_ESTOQUE')"}
* },
*
* attributes={
* "pagination_items_per_page"=10,
* "formats"={"jsonld", "csv"={"text/csv"}}
* }
* )
* @ApiFilter(PropertyFilter::class)
*
* @ApiFilter(SearchFilter::class, properties={"nome": "partial", "documento": "exact", "id": "exact"})
* @ApiFilter(OrderFilter::class, properties={"id", "documento", "nome", "updated"}, arguments={"orderParameterName"="order"})
*
* @EntityHandler(entityHandlerClass="CrosierSource\CrosierLibRadxBundle\EntityHandler\Estoque\MovimentacaoItemEntityHandler")
*
* @ORM\Entity(repositoryClass="CrosierSource\CrosierLibRadxBundle\Repository\Estoque\MovimentacaoItemRepository")
* @ORM\Table(name="est_movimentacao_item")
* @TrackedEntity
*
* @author Carlos Eduardo Pauluk
*/
class MovimentacaoItem implements EntityId
{
use EntityIdTrait;
/**
*
* @ORM\ManyToOne(targetEntity="CrosierSource\CrosierLibRadxBundle\Entity\Estoque\Movimentacao", inversedBy="itens")
* @ORM\JoinColumn(name="movimentacao_id")
*
* @var null|Movimentacao
*/
public ?Movimentacao $movimentacao = null;
/**
*
* @ORM\ManyToOne(targetEntity="CrosierSource\CrosierLibRadxBundle\Entity\Estoque\Produto")
* @ORM\JoinColumn(name="produto_id", nullable=false)
*
* @var null|Produto
*/
public ?Produto $produto = null;
/**
*
* @ORM\Column(name="qtde", type="decimal", precision=15, scale=2)
* @Groups("movimentacaoItem")
*
* @var null|float
*/
public ?float $qtde = null;
/**
*
* @ORM\ManyToOne(targetEntity="CrosierSource\CrosierLibRadxBundle\Entity\Estoque\Unidade")
* @ORM\JoinColumn(name="unidade_id", nullable=false)
*
* @var null|Unidade
*/
public ?Unidade $unidade = null;
/**
*
* @ORM\Column(name="json_data", type="json")
* @var null|array
* @NotUppercase()
* @Groups("movimentacaoItem")
*/
public ?array $jsonData = null;
}