<?php

namespace App\Entity;

use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\OrderRepository;
use DateTimeInterface;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;


/*
 * Bestellungen Status:
 * 1 = Bestellung eingegangen
 * 2 = Bestellung in Bearbeitung
 * 3 = Bestellung versendet
 */

#[ORM\Entity(repositoryClass: OrderRepository::class)]
#[ORM\Table(name: '`order`')]
#[ApiResource]
class Order
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    #[ApiProperty(identifier: false)]
    private ?int $id = null;

    #[ORM\Column(length: 255, unique: true)]
    #[ApiProperty(identifier: true)]
    private ?string $orderId = null;

    #[ORM\Column]
    private ?int $status = null;

    #[ORM\Column]
    private array $data = [];

    #[ORM\Column(name: 'change_date', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
    private ?DateTimeInterface $changeDate = null;

    #[ORM\Column(type: Types::TEXT, nullable: true)]
    private ?string $hiltes = null;

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

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

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

        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;
    }

    public function getChangeDate(): ?DateTimeInterface
    {
        return $this->changeDate;
    }

    public function setChangeDate(DateTimeInterface $changeDate): static
    {
        $this->changeDate = $changeDate;

        return $this;
    }

    public function getHiltes(): ?string
    {
        return $this->hiltes;
    }

    public function setHiltes(?string $hiltes): static
    {
        $this->hiltes = $hiltes;

        return $this;
    }
}