<?php
declare(strict_types=1);

namespace App\Domain\Media;

use App\Framework\Database\Attributes\Column;
use App\Framework\Database\Attributes\Entity;
use App\Framework\Database\Attributes\Type;

#[Entity(tableName: 'images', idColumn: 'ulid')]
final readonly class Image
{
    /** @var ImageVariant[] $variants */
    #[Type(ImageVariant::class, foreignKey: 'image_id', localKey: 'ulid')]
    public array $variants;

    public function __construct(
        /*#[Column(name: 'id', primary: true)]
        public int $id,*/
        #[Column(name: 'ulid', primary: true)]
        public string $ulid,
        #[Column(name: 'filename')]
        public string $filename,
        #[Column(name: 'original_filename')]
        public string $originalFilename,
        #[Column(name: 'mime_type')]
        public string $mimeType,
        #[Column(name: 'file_size')]
        public int    $fileSize,
        #[Column(name: 'width')]
        public int    $width,
        #[Column(name: 'height')]
        public int $height,
        #[Column(name: 'hash'/*, unique: true*/)]
        public string $hash,
        #[Column(name: 'path')]
        public string $path,
        #[Column(name: 'alt_text')]
        public string $altText,
    ){}
}
