<?php

declare(strict_types=1);

namespace App\Entity;

use App\Enum\DeviceModel;
use App\Enum\Orientation;
use App\Enum\RenderStatus;
use App\Repository\RenderedAssetRepository;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity(repositoryClass: RenderedAssetRepository::class)]
#[ORM\UniqueConstraint(fields: ['image', 'deviceModel', 'orientation'])]
class RenderedAsset
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\ManyToOne(inversedBy: 'renderedAssets')]
    #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
    private ?Image $image = null;

    #[ORM\Column(enumType: DeviceModel::class)]
    private DeviceModel $deviceModel;

    #[ORM\Column(enumType: Orientation::class)]
    private Orientation $orientation;

    #[ORM\Column(enumType: RenderStatus::class)]
    private RenderStatus $status = RenderStatus::Pending;

    #[ORM\Column(length: 500, nullable: true)]
    private ?string $filePath = null;

    #[ORM\Column(nullable: true)]
    private ?\DateTimeImmutable $renderedAt = null;

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

    public function getImage(): ?Image { return $this->image; }
    public function setImage(?Image $image): static { $this->image = $image; return $this; }

    public function getDeviceModel(): DeviceModel { return $this->deviceModel; }
    public function setDeviceModel(DeviceModel $m): static { $this->deviceModel = $m; return $this; }

    public function getOrientation(): Orientation { return $this->orientation; }
    public function setOrientation(Orientation $o): static { $this->orientation = $o; return $this; }

    public function getStatus(): RenderStatus { return $this->status; }
    public function setStatus(RenderStatus $s): static { $this->status = $s; return $this; }

    public function getFilePath(): ?string { return $this->filePath; }
    public function setFilePath(?string $p): static { $this->filePath = $p; return $this; }

    public function getRenderedAt(): ?\DateTimeImmutable { return $this->renderedAt; }
    public function setRenderedAt(?\DateTimeImmutable $dt): static { $this->renderedAt = $dt; return $this; }
}
