<?php

namespace App\Entity;

use ApiPlatform\Core\Annotation\ApiProperty;
use App\Repository\OrdersRepository;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Core\Annotation\ApiResource;


#[ORM\Entity(repositoryClass: OrdersRepository::class)]
#[ApiResource(
  itemOperations: ["GET"],
  description: "Manage orders",
  normalizationContext: ["groups" => "read"]
)]
class Orders
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column(type: 'integer')]
    private $id;

    /** Shopware Order ID */
    #[ORM\Column(type: 'string', length: 255)]
    #[Assert\NotBlank]
    #[ApiProperty(example: "467e9804347c4071942c99b55b108142")]
    #[Group("read")]
    private $order_id;

    #[ORM\Column(type: 'integer')]
    #[ApiProperty(example: "1")]
    private $status;

    #[ORM\Column(type: 'json')]
    #[ApiProperty(writable: false)]
    private $data = [];

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getOrderId(): ?string
    {
        return $this->order_id;
    }

    public function setOrderId(string $order_id): self
    {
        $this->order_id = $order_id;

        return $this;
    }

    public function getStatus(): ?int
    {
        return $this->status;
    }

    public function setStatus(int $status): self
    {
        $this->status = $status;

        return $this;
    }

    public function getData(): ?array
    {
        return $this->data;
    }

    public function setData(array $data): self
    {
        $this->data = $data;

        return $this;
    }
}
